Planet Chromium

December 19, 2014

Google Chrome Releases

Dev Channel Update for Chrome OS

The Dev channel has been updated to 41.0.2252.2(Platform version: 6592.0.0/6592.1.0) for all Chrome OS. This build contains a number of bug fixes, security updates and feature enhancements. A list of changes can be found here.

If you find new issues, please let us know by visiting our forum or filing a bug. Interested in switching channels? Find out how. You can submit feedback using ‘Report an issue...’ in the Chrome menu (3 horizontal bars in the upper right corner of the browser).

Dharani Govindan
Google Chrome

by Dharani (noreply@blogger.com) at December 19, 2014 05:17 PM

December 18, 2014

Google Chrome Releases

Dev Channel Update

The dev channel has been updated to 41.0.2251.0 for Windows, Mac and Linux.

A partial list of changes is available in the log. Interested in switching release channels? Find out how. If you find a new issue, please let us know by filing a bug.

Penny MacNeil
Google Chrome

by Penny MacNeil (noreply@blogger.com) at December 18, 2014 11:55 AM

December 17, 2014

Google Chrome Releases

Chrome Beta for Android Update

Chrome Beta for Android has been updated to 40.0.2214.45 and will be available in Google Play over the next few hours. This release fixes various stability and performance bugs.  A partial list of changes in this build is available in the Git log. If you find a new issue, please let us know by filing a bug. More information about Chrome for Android is available on the Chrome site.

Alex Mineer
Google Chrome

by Alex Mineer (noreply@blogger.com) at December 17, 2014 05:07 PM

Beta Channel Update

The beta channel has been updated to 40.0.2214.45 for Windows, Mac and Linux.

A partial list of changes is available in the log. Interested in switching release channels? Find out how. If you find a new issue, please let us know by filing a bug.


Matthew Yuan
Google Chrome

by matthewyuan@chromium.org (noreply@blogger.com) at December 17, 2014 12:30 PM

Beta Update for Chrome OS

The Beta channel has been updated to 40.0.2214.43 (Platform version: 6457.36.0). This build contains a number of bug fixes, security updates, and feature enhancements. Here is a list of Chromium changes.

Some highlights of these changes are:
  • Auto Update for Enterprise-enrolled devices will employ a peer-to-peer (P2P) that reduces Internet bandwidth and allows faster update from nearby devices.
If you find new issues, please let us know by visiting our forum or filing a bug. Interested in switching channels? Find out how. You can submit feedback using ‘Report an issue...’ in the Chrome menu (3 horizontal bars in the upper right corner of the browser).

Daniel Xie
Google Chrome

by Daniel xie (noreply@blogger.com) at December 17, 2014 10:00 AM

December 16, 2014

Chromium Blog

Migrate Your Legacy Packaged Apps to Chrome Apps

In 2010, we created packaged apps to fill a missing link between extensions and hosted apps. They look the same as a hosted app to the user, but under the covers, they are more like traditional extensions. Over time, we realized that a clearer separation between the Chrome browser and apps was necessary, both for security reasons and to conform to user expectations. We launched the next generation of Chrome Apps, a new version of packaged apps, last year to address those issues, and today we're announcing the deprecation of legacy packaged apps.

Starting today, no new legacy packaged apps can be published in the Chrome Web Store. In December, all existing legacy packaged app listings will be removed from the Chrome Web Store’s search and browse functions. Existing legacy packaged apps can be updated until Chrome stops loading them in June of 2015. Nothing will change for hosted apps or new packaged apps.

Updated 12/16/2014: The legacy packaged app deprecation schedule has been revised. In April, all existing legacy packaged app listings will be removed from the Chrome Web Store’s search and browse functions. Existing legacy packaged apps can be updated until Chrome stops loading them in October of 2015.

Developers are strongly encouraged to migrate their legacy packaged apps to either Chrome Apps or extensions. To get started, check out our migration tutorial, and contact us on the chromium-apps forum or our G+ page with any questions.

Posted by Amanda Bishop, Product Manager

by Google Chrome Blog (noreply@blogger.com) at December 16, 2014 09:22 AM

December 15, 2014

Google Chrome Releases

Stable Channel Update for Chrome OS


The Stable channel has been updated to 39.0.2171.96 (Platform version: 6310.68.0). Systems will be automatically updated over the next few weeks. This build contains a number of bug fixes, security updates, and feature enhancements.

Some highlights of these changes are:
  • PPAPI Flash updated to 16.0.0.235-r1
If you find new issues, please let us know by visiting our forum or filing a bug. Interested in switching channels? Find out how. You can submit feedback using ‘Report an issue...’ in the Chrome menu (3 horizontal bars in the upper right corner of the browser).

Ben Henry
Google Chrome

by Ben Henry (noreply@blogger.com) at December 15, 2014 09:06 AM

December 11, 2014

Google Chrome Releases

Dev Channel Update

The dev channel has been updated to 41.0.2243.2 for Mac.

A partial list of changes is available in the log. Interested in switching release channels? Find out how. If you find a new issue, please let us know by filing a bug.

Alex Mineer
Google Chrome

by Alex Mineer (noreply@blogger.com) at December 11, 2014 03:58 PM

Igalia Chromium

Javier Fernández: Web Engines Hackfest 2014

An awesome week is coming to the end and I’d like to thanks the sponsors for helping us to make possible that such an amazing group of hackers could work together to improve the web. We focused on some of the consolidated web engines but also about the most promising ones and, of course, hacking on them producing a good amount of patches.

15972643911_c197af2a23_z

The talks were great, and even better the breakout sessions about many hot topics for the future of the web engines.

15797464819_3eb5d51404_zBecause of the work I’ve been doing lately, I was specially involved in the CSS Features session, which among other things, it complemented the talk Sergio Villar gave us about the Grid Layout implementation we are doing at Igalia in collaboration with Bloomberg.  I introduced as well the work I’ve been doing on the implementation of the Box Alignment specification in both Blink and WebKit web engines; we evaluated how it would impact other layout models, like MathML, CSS Regions, CSS Flexible Box, to ease the logic of blocks and content alignment. We also discussed about the future of CSS regarding new layout models, which is a bit uncertain; there is actually an interesting discussion inside the W3C about this topic, so we will see how it evolves. We talked about graphics and CSS and the SVG specification  (the 2.0 version is being defined) which  will have an important role in the future, as I could personally notice during the last CSSConfEU conference in Berlin; it was also an important topic in other conferences along this year.

15789146369_b390b71cf8_zThis week was a nice opportunity to discuss with other web core hackers the issues I’ve found to properly implement the CSS Box Alignment specification in WebKit, see discussion in the bugzilla for details. We have concluded  that is not an easy problem that should be discussed in the mailing list, as it would imply assuming a performance overhead in CSS parsing. The ‘auto’ value defined by the spec for all the Box Alignment properties, to be resolved during the cascade depending on the type of elements, is affecting the current implementation of Flexible Box and MathML so we will have to find a solution.

I also produced a bunch of patches for WebKit to improve the way we were managing margins and float elements, properly identifying the elements creating a new formatting context and applying some refactoring to make the code clearer; these improvements fixed several issues in Grid Layout as well. Besides, borders, margin and padding was finally adapted in Grid Layout to the different writing-modes, which was a patch I’ve been working for some weeks already and had the opportunity to complete during this hackfest.

I think that’s all for now, hope to see you all in the next Web Engines Hackfest 2015.

sponsors

 

by jfernandez at December 11, 2014 10:10 AM

Google Chrome Releases

Beta Channel Update for Chrome OS

The Beta channel has been updated to 40.0.2214.38 (Platform version: 6457.31.0). This build contains a number of bug fixes, security updates, and feature enhancements. Systems will receive updates over the next several days. Here is a list of Chromium changes.

If you find new issues, please let us know by visiting our forum or filing a bug. Interested in switching channels? Find out how. You can submit feedback using ‘Report an issue...’ in the Chrome menu (3 horizontal bars in the upper right corner of the browser).

Daniel Xie
Google Chrome

by Daniel xie (noreply@blogger.com) at December 11, 2014 09:28 AM

Google Chrome Blog

Chromecast, now with guest mode

You’re having friends over and before you know it, a battle has ensued in your living room over who can show the funniest YouTube video. Now, it’s even easier for your friends to cast to your TV without first having to connect to your WiFi. With the new guest mode feature, anyone with an Android device can cast to your TV as long as they’re in the same room.

To set up guest mode for your Chromecast, open the Chromecast app on your Android phone or tablet and select “Devices” from the navigation drawer. Choose your Chromecast device, tap the “Guest mode” setting and then turn the slider to “on.”

See it in action:
This update is rolling out starting today. Just make sure your Chromecast app is up to date on your Android phone or tablet. To learn more about this feature, visit chromecast.com/guestmode.

Posted by Jagjit Chawla, Product Manager and Host Extraordinaire

by Google Chrome Blog (noreply@blogger.com) at December 11, 2014 08:00 AM

December 10, 2014

Igalia Chromium

Manuel Rego: Web Engines Hackfest 2014

The Hackfest

Web Engines Hackfest 2014 (picture by Adrián Pérez)

Web Engines Hackfest 2014 (picture by Adrián Pérez)

Today we’re finishing the first edition of the Web Engines Hackfest. This is like the continuation of the “WebKitGTK+ Hackfest” that has been organized by Igalia since 2009.

Checking some numbers, we’ve been 30 people working together for 4 full-days (even nights in some cases). On top of that, there’ve been 6 nice talks and several interesting discussions around the open web platform.

As usual the hackfest started with an initial brainstorming where everybody introduced themselves and their plans for the following days. Martin Robinson led the discussion and identified the main topics, that were later debated in detail on the breakout sessions.

The Talks

Despite of being an un-conference format event, this year we’ve arranged a few nice talks about different topics (you can find the slides in the hackfest wiki page):

  • Raspberry Pi Browser by Gustavo Noronha & ChangSeok Oh: They talked about the work done to have a full-browser working in a low specs device like the RPi. They used WebKitGTK+, but not WebKit2 yet, and they need to do some cool tricks to avoid the hardware limitations.
  • CSS Grid Layout by Sergio Villar: Sergio explained the work we’ve been doing around CSS Grid Layout on Blink and WebKit. Apart from explaining some of the nice things of the feature, he revealed our plans to ship it on Chrome during the first quarter of 2015.
  • State of JS Implementations by Andy Wingo: As usual a great talk by Wingo summarizing the evolution of JavaScript during the last years in the open source engines (JSC, SpiderMonkey and V8) and what we can expect in the future. Next year we’ll bring us further optimizations and a faster web for the users.
TyGL presentation by Zoltán Herczeg (picture by Adrián Pérez)

TyGL presentation by Zoltán Herczeg (picture by Adrián Pérez)

  • GPU Based 2D Rendering With TyGL by Zoltán Herczeg: Good introduction to TyGL port explaining all the internals and architecture. The different technical challenges and the solutions provided by TyGL to face them.
  • WebKit for Wayland by Žan Doberšek: Žan presented a new WebKit port for Wayland platform. The main use case for this port is to have a just one web view full-screen (like in a set top box). He explained the internal details and how it’s done the integration with Wayland.
  • A Short Introduction to Servo by Martin Robinson: Martin explained the new parallel browser engine Servo and the Rust programming language behind the scenes. He talked about the current status and the next steps, it should be soon in dog-foodable state.
CSS Features breakout session (picture by Adrián Pérez)

CSS Features breakout session (picture by Adrián Pérez)

My personal experience

From the personal point of view, I’ve been mostly focused on CSS stuff. We’ve a nice discussing regarding the new layout models (from multi-column, flexbox and grid to regions and shapes) and how long they take to be a major feature widely used on the web.

On the one hand, I’ve been carrying on with the regular work I’m lately doing related to CSS Grid Layout. I found and fixed a crash in the absolutely positioned grid children support that landed past week. In addition I managed to get few more tests landed on the grid W3C test suite that we’re starting to create (thanks to Gérard Talbot for the reviews).

A Coruña from San Pedro (picture by Adrián Pérez)

A Coruña from San Pedro (picture by Adrián Pérez)

On the other hand, I’ve been talking with Mihnea Ovidenie about CSS Regions and how CSS Grid Layout could help to avoid the criticism regarding empty HTML elements required to create regions.
Grid allows you to divide the webpage in areas directly from CSS, each area is not associated with an HTML element (a DOM node). So if regions are defined using those areas, it won’t be needed to create empty elements on the DOM tree.
Basically, this seems to match with what is defined in the CSS Pagination Templates module that is being drafted by Alan Stearns.

Thanks

Finally I’d like to thanks to all the people attending (this event wouldn’t be possible without all of you). We hope you enjoined the hackfest and also your stay in A Coruña. See you next year!

Web Engines Hackfest 2014 sponsors: Adobe, Collabora and Igalia

Web Engines Hackfest 2014 sponsors: Adobe, Collabora and Igalia

Also big thanks the sponsors Adobe, Collabora and Igalia for making possible such a great event.

by Manuel Rego Casasnovas at December 10, 2014 06:36 PM

Chromium Blog

Chrome 40 Beta: Powerful Offline and Lightspeed Loading with Service Workers

The newest Chrome Beta channel release includes several new developer features to help you make richer, more compelling web content and apps, especially for mobile devices. Unless otherwise noted, changes described below apply to Chrome for Android, Windows, Mac, Linux, and Chrome OS.

Service Workers

This release adds service workers, a powerful new API that allows developers to make sites work offline by intercepting network requests to deliver programmatic or cached responses. Besides enabling a rich offline experience, developers can also use the API to achieve dramatic performance improvements by caching UI and other common resources between page loads.



A before and after comparison of a repeat visitor loading a site that uses Service Workers.

Unlike other web technologies, the lifetime of a service worker is independent of the page that installed it. This lays the foundation for a new class of web applications with rich background capabilities. For example, future APIs like Push and Background Sync could do their work even after the page is closed, provided the user has given permission.

This release includes two new APIs for use only within service workers. The Fetch API allows service workers to make network requests—including cross-origin—and return the responses to pages they control. The Cache API can save fetched responses and then return them directly the next time the same resource is requested, bypassing the latency-prone network and the eviction-prone HTTP cache.

These APIs are still under active development and we are committed to keeping our implementation in sync with the specifications as they evolve. This release supports a subset of the Cache API, but developers can use a polyfill for full compatibility. If you’re interested in more in-depth information, check out HTML5 Rocks or our collection of useful service worker “recipes.”

Other updates in this release
  • This release brings support for the new directives introduced in Content Security Policy (CSP) Level 2.
  • The new reportValidity method causes Chrome to draw the user’s attention to form fields with validation errors, saving developers from needing to implement this feature manually in JavaScript.
  • Chrome now supports the minlength attribute, a validation feature that allows developers to declare a lower bound on the number of characters a user can input.
  • Thanks to a collaboration with Intel's Open Source Technology Center, Chrome on Mac now uses HarfBuzz for text shaping which improves performance and rendering of non-Latin text, brings new optimizations, and unifies the font system across all platforms.
As always, visit chromestatus.com/features for a complete overview of Chrome’s developer features, and circle +Google Chrome Developers for more frequent updates.

Posted by Dominic Cooney and Joshua Bell, Software Engineers at your service

by Google Chrome Blog (noreply@blogger.com) at December 10, 2014 04:28 PM

Google Chrome Releases

Beta Channel Update

The beta channel has been updated to 40.0.2214.38 for Windows, Mac and Linux.

A partial list of changes is available in the log. Interested in switching release channels? Find out how. If you find a new issue, please let us know by filing a bug.


Matthew Yuan
Google Chrome

by matthewyuan@chromium.org (noreply@blogger.com) at December 10, 2014 12:41 PM

Dev Channel Update for Chrome OS

The Dev channel has been updated to 41.0.2243.0 (Platform version: 6557.0.0) for all Chrome OS. This build contains a number of bug fixes, security updates and feature enhancements. A list of changes can be found here.

If you find new issues, please let us know by visiting our forum or filing a bug. Interested in switching channels? Find out how. You can submit feedback using ‘Report an issue...’ in the Chrome menu (3 horizontal bars in the upper right corner of the browser).

Dharani Govindan
Google Chrome

by Dharani (noreply@blogger.com) at December 10, 2014 04:20 AM

December 09, 2014

Google Chrome Releases

Admin Console Update

The Admin console has been updated with the following changes to user and device settings:
  • A new policy allows admins to allow or disable Smart Lock for Chrome, which allows authorized Android devices to unlock Chrome devices when nearby.
  • A new policy to set the Minimum SSL version allowed on Chrome devices and Chrome on desktop and mobile. 

Known issues are available here. Enterprise customers can report an issue by contacting support.

Lawrence Lui
Google Chrome

by Lawrence L (noreply@blogger.com) at December 09, 2014 03:37 PM

Dev Channel Update

The dev channel has been updated to 41.0.2243.0 for Windows, Mac and Linux.

A partial list of changes is available in the log. Interested in switching release channels? Find out how. If you find a new issue, please let us know by filing a bug.

Penny MacNeil
Google Chrome

by Penny MacNeil (noreply@blogger.com) at December 09, 2014 12:00 PM

Igalia Chromium

Andy Wingo: state of js implementations, 2014 edition

I gave a short talk about the state of JavaScript implementations this year at the Web Engines Hackfest.


29 minutes, vorbis or mp3; slides (PDF)

The talk goes over a bit of the history of JS implementations, with a focus on performance and architecture. It then moves on to talk about what happened in 2014 and some ideas about where 2015 might be going. Have a look if that's a thing you are in to. Thanks to Adobe, Collabora, and Igalia for sponsoring the event.

by Andy Wingo at December 09, 2014 10:29 AM

Google Chrome Releases

Stable Channel Update

The stable channel has been updated to 39.0.2171.95 for Windows, Mac and Linux.  This release contains an update for Adobe Flash as well as a number of other fixes. A full list of changes is available in the log.

Interested in switching release channels? Find out how. If you find a new issue, please let us know by filing a bug.

Alex Mineer
Google Chrome

by Alex Mineer (noreply@blogger.com) at December 09, 2014 10:23 AM

December 08, 2014

Google Chrome Releases

Chrome Beta for Android Update

Chrome Beta for Android has been updated to 40.0.2214.36 and will be available in Google Play over the next few hours. This release fixes various stability and performance bugs.  A partial list of changes in this build is available in the Git log. If you find a new issue, please let us know by filing a bug. More information about Chrome for Android is available on the Chrome site.

Alex Mineer
Google Chrome

by Alex Mineer (noreply@blogger.com) at December 08, 2014 06:32 PM

December 05, 2014

Google Chrome Releases

Dev Channel Update for Chrome OS

The Dev channel has been updated to 41.0.2238.0 (Platform version: 6537.0.0) for all Chrome OS. This build contains a number of bug fixes, security updates and feature enhancements. A list of changes can be found here.

If you find new issues, please let us know by visiting our forum or filing a bug. Interested in switching channels? Find out how. You can submit feedback using ‘Report an issue...’ in the Chrome menu (3 horizontal bars in the upper right corner of the browser).

Dharani Govindan
Google Chrome

by Dharani (noreply@blogger.com) at December 05, 2014 05:14 AM

December 04, 2014

Google Chrome Releases

Beta Channel Update for Chrome OS

The Beta channel has been updated to 40.0.2214.25 (Platform version: 6457.21.0). This build contains a number of bug fixes, security updates, and feature enhancements. Systems will receive updates over the next several days. Here is a list of Chromium changes.

Some highlights of these changes are:
  • The default wallpaper has been updated to Material Design. 
  • Custom wallpapers are now synced across your devices. 
  • Emoji palette allows users to quickly access emoji.

If you find new issues, please let us know by visiting our forum or filing a bug. Interested in switching channels? Find out how. You can submit feedback using ‘Report an issue...’ in the Chrome menu (3 horizontal bars in the upper right corner of the browser).

Daniel Xie
Google Chrome

by Daniel xie (noreply@blogger.com) at December 04, 2014 04:08 PM

Stable Channel Update for Chrome OS

The Stable channel has been updated to 39.0.2171.94 (Platform version: 6310.61.0). Systems will be automatically updated over the next few weeks. This build contains a number of bug fixes, security updates, and feature enhancements.

Some highlights of these changes are:
  • Fix for an issue where the screen flickers on boot and then goes blank (432525)
If you are affected by this problem, please keep your device connected to the network and lid open for an hour to make sure the update is applied. Then restart the device and confirm you are able to see the sign-in screen again.

If you find new issues, please let us know by visiting our forum or filing a bug. Interested in switching channels? Find out how. You can submit feedback using ‘Report an issue...’ in the Chrome menu (3 horizontal bars in the upper right corner of the browser).

Ben Henry
Google Chrome

by Ben Henry (noreply@blogger.com) at December 04, 2014 09:22 AM

Igalia Chromium

Adrián Pérez de Castro: Inception! JS-in-JS!

Apparently this November has been the gloomiest in a while, and that certainly may have slowed down my on-going quest to bring arrow functions to V8. Though arrow functions deserve a write-up themselves, my musings today are about a side quest that started in September, when I had the chance to visit enchanting Berlin one more time, this time as a speaker at JSConf EU.

So what does a guy hacking on JavaScript engines talk about in a conference which is not a lair of compiler neckbeards? Of course it had to be someting related to the implementation of JavaScript engines, but it should have something to do with what can be done with JavaScript. It turns out that V8 has large-ish parts implemented in a subset of JavaScript (and SpiderMonkey; and JavaScriptCore, a bit too!). Enter “Inception: JavaScript-in-JavaScript — where language features are implemented in the language itself any similarity with the movie is a mere coincidence)”.

Intermission

Provided that the video of my talk at JSConf EU is now online, you may want to go watch it now (as an option, with the slides in another window) and come back afterwards to continue reading here.

Did you see the video of the talk? Good, let's recap a bit before continuing.

Engines use JavaScript, too

I made some quick numbers (with CLOC) to give you an idea of how much major engines are using JavaScript themselves. This is the number of thousands of lines of code (kLOC) of the engines themselves, how much of it is JavaScript, and its percentage over the total (excluding the test suites):

Engine Total JS %
JavaScriptCore 269 1 0.3
SpiderMonkey 457 18 3.9
V8 532 23 4.3

Both V8 and SpiderMonkey have a good deal of the runtime library implemented in JavaScript, relying on the JIT to produce machine code to provide a good performance. JavaScriptCore might have an edge in cases where it is not possible to use the JIT and its C++ implementation can be faster when using the interpreter (iOS, anyone?). In the case of V8 the choice of going JavaScript is clear, because it always compiles to machine code.

Most of the features introduced in the runtime library by the ES6 specification can be implemented without needing to touch low-level C++ code. Or do we?

Live-coding %TypedArray%.prototype.forEach()

For my talk in Berlin I wanted to show how accessible it is to use JavaScript itself as an entry point to the guts of V8. What would be better than picking something new from the spec, and live-coding it, let's say the .forEach() method for typed arrays? Because of course, coding while delivering a talk cannot ever go bad.

Live-coding, what could go wrong?

As a first approach, let's write down an initial version of .forEach(), in the very same way as we would if we were writing a polyfill:

function TypedArrayForEach(cb, thisArg) {
    if (thisArg === undefined)
        thisArg = this;
    for (var i = 0; i < this.length; i++)
        cb.call(thisArg, this[i]);
}

But, in which file exactly should this go, and how is it made available in the runtime library? It turns out that there is a bunch of .js files under src/, one of them conspicuously named typedarray.js, prompting us to go ahead and write the above function in the file, plus the following initialization code inside its —also aptly named— SetupTypedArrays() function, right at the end of the macro definition:

function SetupTypedArrays() {
macro SETUP_TYPED_ARRAY(ARRAY_ID, NAME, ELEMENT_SIZE)
    // ...

    // Monkey-patch .forEach() into the prototype
    global.NAME.prototype.forEach = TypedArrayForEach;
endmacro

TYPED_ARRAYS(SETUP_TYPED_ARRAY)
}

Wait! What, macros? Yes, my friends, but before crying out in despair, rebuild V8 and run the freshly built d8 passing --harmony-arrays:

% ./out/x64.debug/d8 --harmony-arrays
V8 version 3.31.0 (candidate) [console: readline]
d8> Int8Array.prototype.forEach
function forEach() { [native code] }
d8>

It is alive!

Standards are hard

At this point we have a working polyfill-style implementation patched in the prototypes of typed arrays, and it works. Yet, it does not quite work as it should. To begin with, the function should throw TypeError if called on an object that is not a typed array, or if the callback is not callable. The spec also mentions that the .length property of the function should be 1 (that is: it is declared as having a single argument), and so on.

You see, formally specifying a programming language is a complex task because all those iffy details have to be figured out. Not to forget about the interactions with other parts of the language, or the existing code bases. In the particular case of JavaScript the backwards compatibility adds a good deal of complexity to the formal semantics, and wading through the hundreds of pages of the ES6 specification can be a daunting task. We may feel compelled to define things differently.

How standards are born, courtesy of XKCD.

Personally, I would eradicate one of the modes, keep just sloppy or strict, but not both. Only that then it would not be JavaScript anymore. Think about all that legacy code that lurks on the depths of the Internet, wouldn't it be nice that it continues to work?

That leads to yet another subtlety: the value passed as thisArg (available as this in the callback function) is expected to be wrapped into an object only for sloppy mode functions — but not for strict mode ones, because strict mode is, well, stricter. While .call() handles this, it is not particularly fast (more on this later), so we may end up needing a way to know which functions are in sloppy mode, do the wrapping ourselves (when needed) and arrange the calls in a more efficient way. We have to assume that there will be code in the wild relying in this behavior. If only we could knew which functions are sloppy!

A better solution

As a matter of fact, the JavaScript engines already know which functions are strict and which ones not. We just cannot get access to that information directly. Fortunately V8 provides a way in which JavaScript code can invoke C++ runtime functions: the functions declared using the RUNTIME_FUNCTION() macro can be invoked from JavaScript, by prefixing their names with %, and if you take a peek into src/runtime/, there are plenty.

To begin with, there is %_CallFunction(), which is used pervasively in the implementation of the runtime library instead of .call(). Using it is an order of magnitude faster, we will be keeping it in our utility belt. Then, there is %IsSloppyModeFunction(), which can be used to find out the “sloppyness” of our callback functions.

But wait! Do you remeber that I mentioned macros above? Take a look at src/macros.py, go, now. Did you see something else interesting in there? Plenty of utility macros, used in the implementation of the runtime library, live there. We can use SHOULD_CREATE_WRAPPER() instead. Also, there are a number of utility functions in src/runtime.js, most annotated with sections of the EcmaScript specification because they do implement algorithms as written in the spec. Using those makes easier to make sure our functions follow all the intrincacies of the spec.

Let's give them a try:

// Do not add a "thisArg" parameter, to make
// TypedArrayForEach.length==1 as per the spec.
function TypedArrayForEach(cb /* thisArg */) {
    // IsTypedArray(), from src/runtime/runtime-typedarray.cc
    // MakeTypeError(), from src/messages.js
    if (!%IsTypedArray(this))
        throw MakeTypeError('not_typed_array', []);

    // IS_SPEC_FUNCTION(), from src/macros.py
    if (!IS_SPEC_FUNCTION(cb))
        throw MakeTypeError('called_non_callable', [cb]));

    var wrap = false;
    var thisArg = this;
    if (arguments.length > 1) {
        thisArg = arguments[1];
        // SHOULD_CREATE_WRAPPER(), from src/macros.py
        wrap = SHOULD_CREATE_WRAPPER(cb, thisArg);
    }

    for (var i = 0; i < this.length; i++) {
        // ToObject(), from src/runtime.js
        %_CallFunction(wrap ? ToObject(thisArg) : thisArg,
                       this[i], i, this, cb);
    }
}

Now that is much closer to the version that went into V8 (which has better debugging support on top), and it covers every the corner cases in the spec. Rejoice!

When in Rome...

Needless to say, there is no documentation for most of the helper functions used to implement the runtime library. The best is to look around and see how functions similar to the one we want to implement are done, while keeping a copy of the spec around for reference.

Do as the tigers do.

Those are a couple of things one can find by scouring the the existing code of the runtime library. First: for typed arrays, the macro in SetupTypedArrays() installs a copy of the functions for each typed array kind, effectively duplicating the code. While this may seem gratuitious, each copy of the function is very likely to be used only on typed arrays in which elements are a certain type. This helps the compiler to generate better code for each of the types.

Second: Runtime functions with the %_ prefix in their names (like %_CallFunction()) do not have their C++ counterpart in src/runtime/. Those are inline runtime functions, for which the code is emitted directly by the code generation phase of the compiler. They are real fast, use them whenever possible!

Next

After coming back from Berlin, I have been implementing the new typed array methods, and the plan is to continue tackling them one at a time.

As mentioned, %TypedArray%.prototype.forEach() is already in V8 (remember to use the --harmony-arrays flag), and so is %TypedArray%.of(), which I think is very handy to create typed arrays without needing to manually assign to each index:

var pow2s = Uint8Array.of(1, 2, 4, 16, 32, 64, 128, 256);

Apart from my occassional announcements (and rants) on Twitter, you can also follow the overall progress by subscribing to issue #3578 in the V8 bug tracker.

Last but not least, a mention to the folks at Bloomberg, who are sponsoring our ongoing work implementing ES6 features. It is great that they are able to invest in improving the web platform not just for themselves, but for everybody else as well. Thanks!

by aperez (adrian@perezdecastro.org) at December 04, 2014 12:00 AM

December 03, 2014

Google Chrome Releases

Beta Channel Update

The beta channel has been updated to 40.0.2214.28 for Windows, Mac and Linux.

A partial list of changes is available in the log. Interested in switching release channels? Find out how. If you find a new issue, please let us know by filing a bug.


Matthew Yuan
Google Chrome

by matthewyuan@chromium.org (noreply@blogger.com) at December 03, 2014 02:23 PM

Chrome for Android Update

Chrome for Android has been updated to 39.0.2171.93 and will be available in Google Play over the next few days. This release fixes issues with Chrome opening in windowed mode, a feedback issue when tapping links, and a number of crash issues. If you find a new issue, please let us know by filing a bug. More information about Chrome for Android is available on the Chrome site.

Jason Kersey
Google Chrome

by Jason Kersey (noreply@blogger.com) at December 03, 2014 11:39 AM

Chrome Beta for Android Update

The Chrome Team is excited to announce the beta release of Chrome 40 for Android. 40.0.2214.27 will be available in Google Play over the next few hours. This release contains a number of bug fixes and updates to page info/content settings. A partial list of changes in this release are available in the Git log. If you find a new issue, please let us know by filing a bug. More information about Chrome for Android is available on the Chrome site.

Jason Kersey
Google Chrome

by Jason Kersey (noreply@blogger.com) at December 03, 2014 10:37 AM

December 02, 2014

Google Chrome Releases

Dev Channel Update

The dev channel has been updated to 41.0.2236.0 for Windows, Mac and Linux.

A partial list of changes is available in the log. Interested in switching release channels? Find out how. If you find a new issue, please let us know by filing a bug.

Alex Mineer
Google Chrome

by Alex Mineer (noreply@blogger.com) at December 02, 2014 10:20 AM

Dev Channel Update for Chrome OS

The Dev channel has been updated to 40.0.2214.25 (Platform version: 6457.21.0) for all Chrome OS devices except HP Chromebook and HP Chromebook 11. This build contains a number of bug fixes, security updates and feature enhancements. A list of changes can be found here.

If you find new issues, please let us know by visiting our forum or filing a bug. Interested in switching channels? Find out how. You can submit feedback using ‘Report an issue...’ in the Chrome menu (3 horizontal bars in the upper right corner of the browser).

Daniel Xie
Google Chrome

by Daniel xie (noreply@blogger.com) at December 02, 2014 09:59 AM