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

Unified Diff: src/compiler/bytecode-graph-builder.cc

Issue 1449373002: [Interpreter] Add support for global loads / stores / calls to BytecodeGraphBuilder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@rmcilroy-0000
Patch Set: Rebase. Created 5 years, 1 month 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/bytecode-graph-builder.h ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/bytecode-graph-builder.cc
diff --git a/src/compiler/bytecode-graph-builder.cc b/src/compiler/bytecode-graph-builder.cc
index 85f6e21046c25ca2aa3f681915a2d424a14cbf9d..5ec3e67e4220f8225e6532290848f7442da7f7ad 100644
--- a/src/compiler/bytecode-graph-builder.cc
+++ b/src/compiler/bytecode-graph-builder.cc
@@ -114,8 +114,8 @@ BytecodeGraphBuilder::BytecodeGraphBuilder(Zone* local_zone,
Node* BytecodeGraphBuilder::GetFunctionContext() {
if (!function_context_.is_set()) {
// Parameter (arity + 1) is special for the outer context of the function
- const Operator* op =
- common()->Parameter(bytecode_array()->parameter_count(), "%context");
+ const Operator* op = common()->Parameter(
+ bytecode_array()->parameter_count() + 1, "%context");
Node* node = NewNode(op, graph()->start());
function_context_.set(node);
}
@@ -179,8 +179,10 @@ bool BytecodeGraphBuilder::CreateGraph(bool stack_check) {
// the formal parameters (including the receiver) plus context and
// closure.
- // The additional count items are for the context and closure.
- int actual_parameter_count = bytecode_array()->parameter_count() + 2;
+ // Set up the basic structure of the graph. Outputs for {Start} are the formal
+ // parameters (including the receiver) plus number of arguments, context and
+ // closure.
+ int actual_parameter_count = bytecode_array()->parameter_count() + 3;
graph()->SetStart(graph()->NewNode(common()->Start(actual_parameter_count)));
Environment env(this, bytecode_array()->register_count(),
@@ -307,74 +309,114 @@ void BytecodeGraphBuilder::VisitStar(
}
+void BytecodeGraphBuilder::BuildLoadGlobal(
+ const interpreter::BytecodeArrayIterator& iterator,
+ TypeofMode typeof_mode) {
+ Handle<Name> name =
+ Handle<Name>::cast(iterator.GetConstantForIndexOperand(0));
+ VectorSlotPair feedback = CreateVectorSlotPair(iterator.GetIndexOperand(1));
+
+ const Operator* op = javascript()->LoadGlobal(name, feedback, typeof_mode);
+ Node* node = NewNode(op, BuildLoadFeedbackVector());
+ AddEmptyFrameStateInputs(node);
+ environment()->BindAccumulator(node);
+}
+
+
void BytecodeGraphBuilder::VisitLdaGlobalSloppy(
const interpreter::BytecodeArrayIterator& iterator) {
- UNIMPLEMENTED();
+ DCHECK(is_sloppy(language_mode()));
+ BuildLoadGlobal(iterator, TypeofMode::NOT_INSIDE_TYPEOF);
}
void BytecodeGraphBuilder::VisitLdaGlobalStrict(
const interpreter::BytecodeArrayIterator& iterator) {
- UNIMPLEMENTED();
+ DCHECK(is_strict(language_mode()));
+ BuildLoadGlobal(iterator, TypeofMode::NOT_INSIDE_TYPEOF);
}
void BytecodeGraphBuilder::VisitLdaGlobalInsideTypeofSloppy(
const interpreter::BytecodeArrayIterator& iterator) {
- UNIMPLEMENTED();
+ DCHECK(is_sloppy(language_mode()));
+ BuildLoadGlobal(iterator, TypeofMode::INSIDE_TYPEOF);
}
void BytecodeGraphBuilder::VisitLdaGlobalInsideTypeofStrict(
const interpreter::BytecodeArrayIterator& iterator) {
- UNIMPLEMENTED();
+ DCHECK(is_strict(language_mode()));
+ BuildLoadGlobal(iterator, TypeofMode::INSIDE_TYPEOF);
}
void BytecodeGraphBuilder::VisitLdaGlobalSloppyWide(
const interpreter::BytecodeArrayIterator& iterator) {
- UNIMPLEMENTED();
+ DCHECK(is_sloppy(language_mode()));
+ BuildLoadGlobal(iterator, TypeofMode::NOT_INSIDE_TYPEOF);
}
void BytecodeGraphBuilder::VisitLdaGlobalStrictWide(
const interpreter::BytecodeArrayIterator& iterator) {
- UNIMPLEMENTED();
+ DCHECK(is_strict(language_mode()));
+ BuildLoadGlobal(iterator, TypeofMode::NOT_INSIDE_TYPEOF);
}
void BytecodeGraphBuilder::VisitLdaGlobalInsideTypeofSloppyWide(
const interpreter::BytecodeArrayIterator& iterator) {
- UNIMPLEMENTED();
+ DCHECK(is_sloppy(language_mode()));
+ BuildLoadGlobal(iterator, TypeofMode::INSIDE_TYPEOF);
}
void BytecodeGraphBuilder::VisitLdaGlobalInsideTypeofStrictWide(
const interpreter::BytecodeArrayIterator& iterator) {
- UNIMPLEMENTED();
+ DCHECK(is_strict(language_mode()));
+ BuildLoadGlobal(iterator, TypeofMode::INSIDE_TYPEOF);
+}
+
+
+void BytecodeGraphBuilder::BuildStoreGlobal(
+ const interpreter::BytecodeArrayIterator& iterator) {
+ Handle<Name> name =
+ Handle<Name>::cast(iterator.GetConstantForIndexOperand(0));
+ VectorSlotPair feedback = CreateVectorSlotPair(iterator.GetIndexOperand(1));
+ Node* value = environment()->LookupAccumulator();
+
+ const Operator* op =
+ javascript()->StoreGlobal(language_mode(), name, feedback);
+ Node* node = NewNode(op, value, BuildLoadFeedbackVector());
+ AddEmptyFrameStateInputs(node);
}
void BytecodeGraphBuilder::VisitStaGlobalSloppy(
const interpreter::BytecodeArrayIterator& iterator) {
- UNIMPLEMENTED();
+ DCHECK(is_sloppy(language_mode()));
+ BuildStoreGlobal(iterator);
}
void BytecodeGraphBuilder::VisitStaGlobalStrict(
const interpreter::BytecodeArrayIterator& iterator) {
- UNIMPLEMENTED();
+ DCHECK(is_strict(language_mode()));
+ BuildStoreGlobal(iterator);
}
void BytecodeGraphBuilder::VisitStaGlobalSloppyWide(
const interpreter::BytecodeArrayIterator& iterator) {
- UNIMPLEMENTED();
+ DCHECK(is_sloppy(language_mode()));
+ BuildStoreGlobal(iterator);
}
void BytecodeGraphBuilder::VisitStaGlobalStrictWide(
const interpreter::BytecodeArrayIterator& iterator) {
- UNIMPLEMENTED();
+ DCHECK(is_strict(language_mode()));
+ BuildStoreGlobal(iterator);
}
« no previous file with comments | « src/compiler/bytecode-graph-builder.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698