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/compile-time-value.h" | 7 #include "src/ast/compile-time-value.h" |
8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/compilation-info.h" | 10 #include "src/compilation-info.h" |
(...skipping 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1398 | 1398 |
1399 void BytecodeGenerator::VisitDebuggerStatement(DebuggerStatement* stmt) { | 1399 void BytecodeGenerator::VisitDebuggerStatement(DebuggerStatement* stmt) { |
1400 builder()->SetStatementPosition(stmt); | 1400 builder()->SetStatementPosition(stmt); |
1401 builder()->Debugger(); | 1401 builder()->Debugger(); |
1402 } | 1402 } |
1403 | 1403 |
1404 void BytecodeGenerator::VisitFunctionLiteral(FunctionLiteral* expr) { | 1404 void BytecodeGenerator::VisitFunctionLiteral(FunctionLiteral* expr) { |
1405 uint8_t flags = CreateClosureFlags::Encode(expr->pretenure(), | 1405 uint8_t flags = CreateClosureFlags::Encode(expr->pretenure(), |
1406 scope()->is_function_scope()); | 1406 scope()->is_function_scope()); |
1407 size_t entry = builder()->AllocateConstantPoolEntry(); | 1407 size_t entry = builder()->AllocateConstantPoolEntry(); |
1408 int slot_index = feedback_index(expr->LiteralFeedbackSlot()); | 1408 builder()->CreateClosure(entry, flags); |
1409 builder()->CreateClosure(entry, slot_index, flags); | |
1410 function_literals_.push_back(std::make_pair(expr, entry)); | 1409 function_literals_.push_back(std::make_pair(expr, entry)); |
1411 } | 1410 } |
1412 | 1411 |
1413 void BytecodeGenerator::VisitClassLiteral(ClassLiteral* expr) { | 1412 void BytecodeGenerator::VisitClassLiteral(ClassLiteral* expr) { |
1414 VisitClassLiteralForRuntimeDefinition(expr); | 1413 VisitClassLiteralForRuntimeDefinition(expr); |
1415 | 1414 |
1416 // Load the "prototype" from the constructor. | 1415 // Load the "prototype" from the constructor. |
1417 Register literal = register_allocator()->NewRegister(); | 1416 Register literal = register_allocator()->NewRegister(); |
1418 Register prototype = register_allocator()->NewRegister(); | 1417 Register prototype = register_allocator()->NewRegister(); |
1419 FeedbackVectorSlot slot = expr->PrototypeSlot(); | 1418 FeedbackVectorSlot slot = expr->PrototypeSlot(); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1532 expr->has_static_computed_names() | 1531 expr->has_static_computed_names() |
1533 ? Runtime::kInstallClassNameAccessorWithCheck | 1532 ? Runtime::kInstallClassNameAccessorWithCheck |
1534 : Runtime::kInstallClassNameAccessor; | 1533 : Runtime::kInstallClassNameAccessor; |
1535 builder()->CallRuntime(runtime_id, literal); | 1534 builder()->CallRuntime(runtime_id, literal); |
1536 } | 1535 } |
1537 } | 1536 } |
1538 | 1537 |
1539 void BytecodeGenerator::VisitNativeFunctionLiteral( | 1538 void BytecodeGenerator::VisitNativeFunctionLiteral( |
1540 NativeFunctionLiteral* expr) { | 1539 NativeFunctionLiteral* expr) { |
1541 size_t entry = builder()->AllocateConstantPoolEntry(); | 1540 size_t entry = builder()->AllocateConstantPoolEntry(); |
1542 int slot_index = feedback_index(expr->LiteralFeedbackSlot()); | 1541 builder()->CreateClosure(entry, NOT_TENURED); |
1543 builder()->CreateClosure(entry, slot_index, NOT_TENURED); | |
1544 native_function_literals_.push_back(std::make_pair(expr, entry)); | 1542 native_function_literals_.push_back(std::make_pair(expr, entry)); |
1545 } | 1543 } |
1546 | 1544 |
1547 void BytecodeGenerator::VisitDoExpression(DoExpression* expr) { | 1545 void BytecodeGenerator::VisitDoExpression(DoExpression* expr) { |
1548 VisitBlock(expr->block()); | 1546 VisitBlock(expr->block()); |
1549 VisitVariableProxy(expr->result()); | 1547 VisitVariableProxy(expr->result()); |
1550 } | 1548 } |
1551 | 1549 |
1552 void BytecodeGenerator::VisitConditional(Conditional* expr) { | 1550 void BytecodeGenerator::VisitConditional(Conditional* expr) { |
1553 if (expr->condition()->ToBooleanIsTrue()) { | 1551 if (expr->condition()->ToBooleanIsTrue()) { |
(...skipping 1754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3308 } | 3306 } |
3309 | 3307 |
3310 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { | 3308 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { |
3311 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict | 3309 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict |
3312 : Runtime::kStoreKeyedToSuper_Sloppy; | 3310 : Runtime::kStoreKeyedToSuper_Sloppy; |
3313 } | 3311 } |
3314 | 3312 |
3315 } // namespace interpreter | 3313 } // namespace interpreter |
3316 } // namespace internal | 3314 } // namespace internal |
3317 } // namespace v8 | 3315 } // namespace v8 |
OLD | NEW |