Index: src/runtime/runtime-object.cc |
diff --git a/src/runtime/runtime-object.cc b/src/runtime/runtime-object.cc |
index ebaf006a4ffe748a5f86803acd8bfe854aca9f6c..b9c3fdf1bedbdc09643c164347be4cdf14a92281 100644 |
--- a/src/runtime/runtime-object.cc |
+++ b/src/runtime/runtime-object.cc |
@@ -420,9 +420,8 @@ RUNTIME_FUNCTION(Runtime_ObjectSeal) { |
RUNTIME_FUNCTION(Runtime_LoadGlobalViaContext) { |
HandleScope scope(isolate); |
- DCHECK_EQ(2, args.length()); |
+ DCHECK_EQ(1, args.length()); |
CONVERT_SMI_ARG_CHECKED(slot, 0); |
- CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); |
// Go up context chain to the script context. |
Handle<Context> script_context(isolate->context()->script_context(), isolate); |
@@ -430,12 +429,15 @@ RUNTIME_FUNCTION(Runtime_LoadGlobalViaContext) { |
DCHECK(script_context->get(slot)->IsPropertyCell()); |
// Lookup the named property on the global object. |
+ Handle<ScopeInfo> scope_info(ScopeInfo::cast(script_context->extension()), |
+ isolate); |
+ Handle<Name> name(scope_info->ContextSlotName(slot), isolate); |
Handle<GlobalObject> global_object(script_context->global_object(), isolate); |
LookupIterator it(global_object, name, LookupIterator::HIDDEN); |
// Switch to fast mode only if there is a data property and it's not on |
// a hidden prototype. |
- if (it.state() == LookupIterator::DATA && |
+ if (LookupIterator::DATA == it.state() && |
it.GetHolder<Object>()->IsJSGlobalObject()) { |
// Now update the cell in the script context. |
Handle<PropertyCell> cell = it.GetPropertyCell(); |
@@ -454,8 +456,7 @@ RUNTIME_FUNCTION(Runtime_LoadGlobalViaContext) { |
namespace { |
-Object* StoreGlobalViaContext(Isolate* isolate, int slot, Handle<Name> name, |
- Handle<Object> value, |
+Object* StoreGlobalViaContext(Isolate* isolate, int slot, Handle<Object> value, |
LanguageMode language_mode) { |
// Go up context chain to the script context. |
Handle<Context> script_context(isolate->context()->script_context(), isolate); |
@@ -463,6 +464,9 @@ Object* StoreGlobalViaContext(Isolate* isolate, int slot, Handle<Name> name, |
DCHECK(script_context->get(slot)->IsPropertyCell()); |
// Lookup the named property on the global object. |
+ Handle<ScopeInfo> scope_info(ScopeInfo::cast(script_context->extension()), |
+ isolate); |
+ Handle<Name> name(scope_info->ContextSlotName(slot), isolate); |
Handle<GlobalObject> global_object(script_context->global_object(), isolate); |
LookupIterator it(global_object, name, LookupIterator::HIDDEN); |
// Switch to fast mode only if there is a data property and it's not on |
@@ -491,23 +495,21 @@ Object* StoreGlobalViaContext(Isolate* isolate, int slot, Handle<Name> name, |
RUNTIME_FUNCTION(Runtime_StoreGlobalViaContext_Sloppy) { |
HandleScope scope(isolate); |
- DCHECK_EQ(3, args.length()); |
+ DCHECK_EQ(2, args.length()); |
CONVERT_SMI_ARG_CHECKED(slot, 0); |
- CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); |
- CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); |
+ CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); |
- return StoreGlobalViaContext(isolate, slot, name, value, SLOPPY); |
+ return StoreGlobalViaContext(isolate, slot, value, SLOPPY); |
} |
RUNTIME_FUNCTION(Runtime_StoreGlobalViaContext_Strict) { |
HandleScope scope(isolate); |
- DCHECK_EQ(3, args.length()); |
+ DCHECK_EQ(2, args.length()); |
CONVERT_SMI_ARG_CHECKED(slot, 0); |
- CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); |
- CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); |
+ CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); |
- return StoreGlobalViaContext(isolate, slot, name, value, STRICT); |
+ return StoreGlobalViaContext(isolate, slot, value, STRICT); |
} |