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

Unified Diff: src/compiler/js-generic-lowering.cc

Issue 503603003: Make AST graph builder parametric in context specialization. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Only modify js-generic-lowering. Created 6 years, 4 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 | « src/compiler/js-generic-lowering.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « src/compiler/js-generic-lowering.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698