OLD | NEW |
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 1343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1354 if (shared_info.is_null()) { | 1354 if (shared_info.is_null()) { |
1355 return SetStackOverflow(); | 1355 return SetStackOverflow(); |
1356 } | 1356 } |
1357 uint8_t flags = CreateClosureFlags::Encode(expr->pretenure(), | 1357 uint8_t flags = CreateClosureFlags::Encode(expr->pretenure(), |
1358 scope()->is_function_scope()); | 1358 scope()->is_function_scope()); |
1359 builder()->CreateClosure(shared_info, flags); | 1359 builder()->CreateClosure(shared_info, flags); |
1360 execution_result()->SetResultInAccumulator(); | 1360 execution_result()->SetResultInAccumulator(); |
1361 } | 1361 } |
1362 | 1362 |
1363 void BytecodeGenerator::VisitClassLiteral(ClassLiteral* expr) { | 1363 void BytecodeGenerator::VisitClassLiteral(ClassLiteral* expr) { |
1364 if (expr->scope()->ContextLocalCount() > 0) { | |
1365 VisitNewLocalBlockContext(expr->scope()); | |
1366 ContextScope scope(this, expr->scope()); | |
1367 VisitDeclarations(expr->scope()->declarations()); | |
1368 VisitClassLiteralContents(expr); | |
1369 } else { | |
1370 VisitDeclarations(expr->scope()->declarations()); | |
1371 VisitClassLiteralContents(expr); | |
1372 } | |
1373 } | |
1374 | |
1375 void BytecodeGenerator::VisitClassLiteralContents(ClassLiteral* expr) { | |
1376 VisitClassLiteralForRuntimeDefinition(expr); | 1364 VisitClassLiteralForRuntimeDefinition(expr); |
1377 | 1365 |
1378 // Load the "prototype" from the constructor. | 1366 // Load the "prototype" from the constructor. |
1379 register_allocator()->PrepareForConsecutiveAllocations(2); | 1367 register_allocator()->PrepareForConsecutiveAllocations(2); |
1380 Register literal = register_allocator()->NextConsecutiveRegister(); | 1368 Register literal = register_allocator()->NextConsecutiveRegister(); |
1381 Register prototype = register_allocator()->NextConsecutiveRegister(); | 1369 Register prototype = register_allocator()->NextConsecutiveRegister(); |
1382 Handle<String> name = isolate()->factory()->prototype_string(); | 1370 Handle<String> name = isolate()->factory()->prototype_string(); |
1383 FeedbackVectorSlot slot = expr->PrototypeSlot(); | 1371 FeedbackVectorSlot slot = expr->PrototypeSlot(); |
1384 builder() | 1372 builder() |
1385 ->StoreAccumulatorInRegister(literal) | 1373 ->StoreAccumulatorInRegister(literal) |
(...skipping 1853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3239 return execution_context()->scope()->language_mode(); | 3227 return execution_context()->scope()->language_mode(); |
3240 } | 3228 } |
3241 | 3229 |
3242 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 3230 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |
3243 return TypeFeedbackVector::GetIndex(slot); | 3231 return TypeFeedbackVector::GetIndex(slot); |
3244 } | 3232 } |
3245 | 3233 |
3246 } // namespace interpreter | 3234 } // namespace interpreter |
3247 } // namespace internal | 3235 } // namespace internal |
3248 } // namespace v8 | 3236 } // namespace v8 |
OLD | NEW |