Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Unified Diff: src/runtime/runtime-object.cc

Issue 1236523004: Follow-up for "Enable loads and stores to global vars through property cell shortcuts installed..." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/cctest/test-serialize.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-object.cc
diff --git a/src/runtime/runtime-object.cc b/src/runtime/runtime-object.cc
index 8a3d0a1febdebe758c1c02b6f163837d82894746..0bdde7482c509df9aed274e94738e701c3fb5935 100644
--- a/src/runtime/runtime-object.cc
+++ b/src/runtime/runtime-object.cc
@@ -432,8 +432,11 @@ RUNTIME_FUNCTION(Runtime_LoadGlobalViaContext) {
Handle<GlobalObject> global(script_context->global_object());
- LookupIterator it(global, name, LookupIterator::OWN);
- if (LookupIterator::DATA == it.state()) {
+ LookupIterator it(global, name, LookupIterator::HIDDEN);
+ // Switch to fast mode only if there is a data property and it's not on
+ // a hidden prototype.
+ if (LookupIterator::DATA == it.state() &&
+ it.GetHolder<Object>()->IsJSGlobalObject()) {
// Now update cell in the script context.
Handle<PropertyCell> cell = it.GetPropertyCell();
script_context->set(index, *cell);
@@ -464,8 +467,11 @@ RUNTIME_FUNCTION(Runtime_StoreGlobalViaContext) {
Handle<GlobalObject> global(script_context->global_object());
- LookupIterator it(global, name, LookupIterator::OWN);
- if (LookupIterator::DATA == it.state()) {
+ LookupIterator it(global, name, LookupIterator::HIDDEN);
+ // Switch to fast mode only if there is a data property and it's not on
+ // a hidden prototype.
+ if (LookupIterator::DATA == it.state() &&
+ it.GetHolder<Object>()->IsJSGlobalObject()) {
// Now update cell in the script context.
Handle<PropertyCell> cell = it.GetPropertyCell();
script_context->set(index, *cell);
« no previous file with comments | « no previous file | test/cctest/test-serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698