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

Unified Diff: src/compiler/js-context-specialization.cc

Issue 473263004: Towards removing dependency from generic lowering on compilation info. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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
Index: src/compiler/js-context-specialization.cc
diff --git a/src/compiler/js-context-specialization.cc b/src/compiler/js-context-specialization.cc
index bdf142763a8887ca3db22cdda719b94eae24f86a..70911915122d1274bc705c739d025b4e3c4cb286 100644
--- a/src/compiler/js-context-specialization.cc
+++ b/src/compiler/js-context-specialization.cc
@@ -69,6 +69,7 @@ class ContextSpecializationVisitor : public NullNodeVisitor {
void JSContextSpecializer::SpecializeToContext() {
ReplaceEffectfulWithValue(context_, jsgraph_->Constant(info_->context()));
+ specialized_ = true;
ContextSpecializationVisitor visitor(this);
jsgraph_->graph()->VisitNodeInputsFromEnd(&visitor);
@@ -152,6 +153,28 @@ Reduction JSContextSpecializer::ReduceJSStoreContext(Node* node) {
return Reducer::Changed(node);
}
+
+
+Node* JSContextSpecializer::InsertBuiltinLoadBefore(Node* before,
+ Builtins::JavaScript id) {
+ if (specialized_) {
+ Handle<JSFunction> function(
+ JSFunction::cast(info_->context()->builtins()->javascript_builtin(id)));
+ return jsgraph_->HeapConstant(function);
+ }
+ Node* context = NodeProperties::GetContextInput(before);
+ Node* global = jsgraph_->LoadObjectField(
+ context,
+ Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX) + kHeapObjectTag,
+ context, NodeProperties::GetEffectInput(before));
+ Node* builtins = jsgraph_->LoadObjectField(
+ global, JSGlobalObject::kBuiltinsOffset, context, global);
+ Node* function_node = jsgraph_->LoadObjectField(
+ builtins, JSBuiltinsObject::OffsetOfFunctionWithId(id), context,
+ builtins);
+ NodeProperties::ReplaceEffectInput(before, function_node);
+ return function_node;
+}
}
}
} // namespace v8::internal::compiler

Powered by Google App Engine
This is Rietveld 408576698