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

Unified Diff: src/interpreter/bytecode-generator.cc

Issue 2703563002: [ESNext] Implement DynamicImportCall (Closed)
Patch Set: add more tests Created 3 years, 9 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/interpreter/bytecode-generator.h ('k') | src/isolate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecode-generator.cc
diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc
index 052f29367dadd6a4fa1b5fca9948f9ffe4c66a41..6ab002e03e6270ddb26630df446b9855304f32d0 100644
--- a/src/interpreter/bytecode-generator.cc
+++ b/src/interpreter/bytecode-generator.cc
@@ -635,7 +635,9 @@ BytecodeGenerator::BytecodeGenerator(CompilationInfo* info)
execution_result_(nullptr),
generator_resume_points_(info->literal()->yield_count(), info->zone()),
generator_state_(),
- loop_depth_(0) {
+ loop_depth_(0),
+ source_url_entry_(0),
+ has_source_url_entry_(false) {
DCHECK_EQ(closure_scope(), closure_scope()->GetClosureScope());
}
@@ -696,6 +698,11 @@ void BytecodeGenerator::AllocateDeferredConstants(Isolate* isolate) {
array_literal->GetOrBuildConstantElements(isolate);
builder()->SetDeferredConstantPoolEntry(literal.second, constant_elements);
}
+
+ if (has_source_url_entry()) {
+ Handle<String> url(String::cast(info()->script()->name()));
+ builder()->SetDeferredConstantPoolEntry(source_url_entry(), url);
+ }
}
void BytecodeGenerator::GenerateBytecode(uintptr_t stack_limit) {
@@ -3003,6 +3010,23 @@ void BytecodeGenerator::VisitEmptyParentheses(EmptyParentheses* expr) {
UNREACHABLE();
}
+void BytecodeGenerator::VisitImportCallExpression(ImportCallExpression* expr) {
+ size_t entry;
+ if (has_source_url_entry()) {
+ entry = source_url_entry();
+ } else {
+ entry = builder()->AllocateDeferredConstantPoolEntry();
rmcilroy 2017/03/16 09:12:38 Instead of storing this seperately, could you just
gsathya 2017/03/17 00:47:22 Done.
+ set_source_url_entry(entry);
+ }
+
+ RegisterList args = register_allocator()->NewRegisterList(2);
+ VisitForRegisterValue(expr->argument(), args[1]);
+ builder()
+ ->LoadConstantPoolEntry(entry)
+ .StoreAccumulatorInRegister(args[0])
+ .CallRuntime(Runtime::kDynamicImportCall, args);
+}
+
void BytecodeGenerator::VisitGetIterator(GetIterator* expr) {
FeedbackSlot load_slot = expr->IteratorPropertyFeedbackSlot();
FeedbackSlot call_slot = expr->IteratorCallFeedbackSlot();
« no previous file with comments | « src/interpreter/bytecode-generator.h ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698