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

Side by Side Diff: src/interpreter/bytecode-generator.cc

Issue 2176653003: Wrap ClassLiterals in DoExpressions instead of giving them BlockScopes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/interpreter/bytecode-generator.h" 5 #include "src/interpreter/bytecode-generator.h"
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/compiler.h" 9 #include "src/compiler.h"
10 #include "src/interpreter/bytecode-flags.h" 10 #include "src/interpreter/bytecode-flags.h"
(...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 if (shared_info.is_null()) { 1294 if (shared_info.is_null()) {
1295 return SetStackOverflow(); 1295 return SetStackOverflow();
1296 } 1296 }
1297 uint8_t flags = CreateClosureFlags::Encode(expr->pretenure(), 1297 uint8_t flags = CreateClosureFlags::Encode(expr->pretenure(),
1298 scope()->is_function_scope()); 1298 scope()->is_function_scope());
1299 builder()->CreateClosure(shared_info, flags); 1299 builder()->CreateClosure(shared_info, flags);
1300 execution_result()->SetResultInAccumulator(); 1300 execution_result()->SetResultInAccumulator();
1301 } 1301 }
1302 1302
1303 void BytecodeGenerator::VisitClassLiteral(ClassLiteral* expr) { 1303 void BytecodeGenerator::VisitClassLiteral(ClassLiteral* expr) {
1304 if (expr->scope()->ContextLocalCount() > 0) {
1305 VisitNewLocalBlockContext(expr->scope());
1306 ContextScope scope(this, expr->scope());
1307 VisitDeclarations(expr->scope()->declarations());
1308 VisitClassLiteralContents(expr);
1309 } else {
1310 VisitDeclarations(expr->scope()->declarations());
1311 VisitClassLiteralContents(expr);
1312 }
1313 }
1314
1315 void BytecodeGenerator::VisitClassLiteralContents(ClassLiteral* expr) {
1316 VisitClassLiteralForRuntimeDefinition(expr); 1304 VisitClassLiteralForRuntimeDefinition(expr);
1317 1305
1318 // Load the "prototype" from the constructor. 1306 // Load the "prototype" from the constructor.
1319 register_allocator()->PrepareForConsecutiveAllocations(2); 1307 register_allocator()->PrepareForConsecutiveAllocations(2);
1320 Register literal = register_allocator()->NextConsecutiveRegister(); 1308 Register literal = register_allocator()->NextConsecutiveRegister();
1321 Register prototype = register_allocator()->NextConsecutiveRegister(); 1309 Register prototype = register_allocator()->NextConsecutiveRegister();
1322 Handle<String> name = isolate()->factory()->prototype_string(); 1310 Handle<String> name = isolate()->factory()->prototype_string();
1323 FeedbackVectorSlot slot = expr->PrototypeSlot(); 1311 FeedbackVectorSlot slot = expr->PrototypeSlot();
1324 builder() 1312 builder()
1325 ->StoreAccumulatorInRegister(literal) 1313 ->StoreAccumulatorInRegister(literal)
(...skipping 1853 matching lines...) Expand 10 before | Expand all | Expand 10 after
3179 return execution_context()->scope()->language_mode(); 3167 return execution_context()->scope()->language_mode();
3180 } 3168 }
3181 3169
3182 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { 3170 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const {
3183 return TypeFeedbackVector::GetIndex(slot); 3171 return TypeFeedbackVector::GetIndex(slot);
3184 } 3172 }
3185 3173
3186 } // namespace interpreter 3174 } // namespace interpreter
3187 } // namespace internal 3175 } // namespace internal
3188 } // namespace v8 3176 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698