| 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 builder()->CreateClosure(entry, flags); | 1408 int slot_index = feedback_index(expr->LiteralFeedbackSlot()); |
| 1409 builder()->CreateClosure(entry, slot_index, flags); |
| 1409 function_literals_.push_back(std::make_pair(expr, entry)); | 1410 function_literals_.push_back(std::make_pair(expr, entry)); |
| 1410 } | 1411 } |
| 1411 | 1412 |
| 1412 void BytecodeGenerator::VisitClassLiteral(ClassLiteral* expr) { | 1413 void BytecodeGenerator::VisitClassLiteral(ClassLiteral* expr) { |
| 1413 VisitClassLiteralForRuntimeDefinition(expr); | 1414 VisitClassLiteralForRuntimeDefinition(expr); |
| 1414 | 1415 |
| 1415 // Load the "prototype" from the constructor. | 1416 // Load the "prototype" from the constructor. |
| 1416 Register literal = register_allocator()->NewRegister(); | 1417 Register literal = register_allocator()->NewRegister(); |
| 1417 Register prototype = register_allocator()->NewRegister(); | 1418 Register prototype = register_allocator()->NewRegister(); |
| 1418 FeedbackVectorSlot slot = expr->PrototypeSlot(); | 1419 FeedbackVectorSlot slot = expr->PrototypeSlot(); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1531 expr->has_static_computed_names() | 1532 expr->has_static_computed_names() |
| 1532 ? Runtime::kInstallClassNameAccessorWithCheck | 1533 ? Runtime::kInstallClassNameAccessorWithCheck |
| 1533 : Runtime::kInstallClassNameAccessor; | 1534 : Runtime::kInstallClassNameAccessor; |
| 1534 builder()->CallRuntime(runtime_id, literal); | 1535 builder()->CallRuntime(runtime_id, literal); |
| 1535 } | 1536 } |
| 1536 } | 1537 } |
| 1537 | 1538 |
| 1538 void BytecodeGenerator::VisitNativeFunctionLiteral( | 1539 void BytecodeGenerator::VisitNativeFunctionLiteral( |
| 1539 NativeFunctionLiteral* expr) { | 1540 NativeFunctionLiteral* expr) { |
| 1540 size_t entry = builder()->AllocateConstantPoolEntry(); | 1541 size_t entry = builder()->AllocateConstantPoolEntry(); |
| 1541 builder()->CreateClosure(entry, NOT_TENURED); | 1542 int slot_index = feedback_index(expr->LiteralFeedbackSlot()); |
| 1543 builder()->CreateClosure(entry, slot_index, NOT_TENURED); |
| 1542 native_function_literals_.push_back(std::make_pair(expr, entry)); | 1544 native_function_literals_.push_back(std::make_pair(expr, entry)); |
| 1543 } | 1545 } |
| 1544 | 1546 |
| 1545 void BytecodeGenerator::VisitDoExpression(DoExpression* expr) { | 1547 void BytecodeGenerator::VisitDoExpression(DoExpression* expr) { |
| 1546 VisitBlock(expr->block()); | 1548 VisitBlock(expr->block()); |
| 1547 VisitVariableProxy(expr->result()); | 1549 VisitVariableProxy(expr->result()); |
| 1548 } | 1550 } |
| 1549 | 1551 |
| 1550 void BytecodeGenerator::VisitConditional(Conditional* expr) { | 1552 void BytecodeGenerator::VisitConditional(Conditional* expr) { |
| 1551 if (expr->condition()->ToBooleanIsTrue()) { | 1553 if (expr->condition()->ToBooleanIsTrue()) { |
| (...skipping 1754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3306 } | 3308 } |
| 3307 | 3309 |
| 3308 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { | 3310 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { |
| 3309 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict | 3311 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict |
| 3310 : Runtime::kStoreKeyedToSuper_Sloppy; | 3312 : Runtime::kStoreKeyedToSuper_Sloppy; |
| 3311 } | 3313 } |
| 3312 | 3314 |
| 3313 } // namespace interpreter | 3315 } // namespace interpreter |
| 3314 } // namespace internal | 3316 } // namespace internal |
| 3315 } // namespace v8 | 3317 } // namespace v8 |
| OLD | NEW |