| Index: src/compiler/js-generic-lowering.cc
|
| diff --git a/src/compiler/js-generic-lowering.cc b/src/compiler/js-generic-lowering.cc
|
| index f9ac3ee8114608b3401e6b0cc76f411b8892f55b..fee82bf975a8b9015cfdf0242b5e5916176018fa 100644
|
| --- a/src/compiler/js-generic-lowering.cc
|
| +++ b/src/compiler/js-generic-lowering.cc
|
| @@ -339,18 +339,41 @@ void JSGenericLowering::ReplaceWithICStubCall(Node* node,
|
| }
|
|
|
|
|
| +Node* JSGenericLowering::LoadObjectField(Node* object, int offset,
|
| + Node* effect) {
|
| + MachineOperatorBuilder machine(jsgraph()->zone());
|
| + Node* field_load = jsgraph()->graph()->NewNode(
|
| + machine.Load(kMachAnyTagged), object,
|
| + jsgraph()->Int32Constant(offset - kHeapObjectTag), effect);
|
| + return field_load;
|
| +}
|
| +
|
| +
|
| void JSGenericLowering::ReplaceWithBuiltinCall(Node* node,
|
| Builtins::JavaScript id,
|
| int nargs) {
|
| CallFunctionStub stub(isolate(), nargs - 1, NO_CALL_FUNCTION_FLAGS);
|
| CodeStubInterfaceDescriptor* d = GetInterfaceDescriptor(isolate(), &stub);
|
| CallDescriptor* desc = linkage()->GetStubCallDescriptor(d, nargs);
|
| - // TODO(mstarzinger): Accessing the builtins object this way prevents sharing
|
| - // of code across native contexts. Fix this by loading from given context.
|
| - Handle<JSFunction> function(
|
| - JSFunction::cast(info()->context()->builtins()->javascript_builtin(id)));
|
| Node* stub_code = CodeConstant(stub.GetCode());
|
| - Node* function_node = FunctionConstant(function);
|
| + Node* function_node = NULL;
|
| + if (info()->is_context_specializing()) {
|
| + Handle<JSFunction> function(JSFunction::cast(
|
| + info()->context()->builtins()->javascript_builtin(id)));
|
| + function_node = FunctionConstant(function);
|
| + } else {
|
| + Node* context = NodeProperties::GetContextInput(node);
|
| + Node* effect = NodeProperties::GetEffectInput(node);
|
| + Node* global = LoadObjectField(
|
| + context,
|
| + Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX) + kHeapObjectTag,
|
| + effect);
|
| + Node* builtins =
|
| + LoadObjectField(global, JSGlobalObject::kBuiltinsOffset, effect);
|
| + function_node = LoadObjectField(
|
| + builtins, JSBuiltinsObject::OffsetOfFunctionWithId(id), effect);
|
| + NodeProperties::ReplaceEffectInput(node, function_node);
|
| + }
|
| PatchInsertInput(node, 0, stub_code);
|
| PatchInsertInput(node, 1, function_node);
|
| PatchOperator(node, common()->Call(desc));
|
| @@ -445,8 +468,8 @@ Node* JSGenericLowering::LowerJSStoreNamed(Node* node) {
|
|
|
| Node* JSGenericLowering::LowerJSDeleteProperty(Node* node) {
|
| StrictMode strict_mode = OpParameter<StrictMode>(node);
|
| - PatchInsertInput(node, 2, SmiConstant(strict_mode));
|
| ReplaceWithBuiltinCall(node, Builtins::DELETE, 3);
|
| + PatchInsertInput(node, 4, SmiConstant(strict_mode));
|
| return node;
|
| }
|
|
|
|
|