| 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/builtins/builtins-constructor.h" | 9 #include "src/builtins/builtins-constructor.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1399 | 1399 |
| 1400 void BytecodeGenerator::VisitDebuggerStatement(DebuggerStatement* stmt) { | 1400 void BytecodeGenerator::VisitDebuggerStatement(DebuggerStatement* stmt) { |
| 1401 builder()->SetStatementPosition(stmt); | 1401 builder()->SetStatementPosition(stmt); |
| 1402 builder()->Debugger(); | 1402 builder()->Debugger(); |
| 1403 } | 1403 } |
| 1404 | 1404 |
| 1405 void BytecodeGenerator::VisitFunctionLiteral(FunctionLiteral* expr) { | 1405 void BytecodeGenerator::VisitFunctionLiteral(FunctionLiteral* expr) { |
| 1406 uint8_t flags = CreateClosureFlags::Encode(expr->pretenure(), | 1406 uint8_t flags = CreateClosureFlags::Encode(expr->pretenure(), |
| 1407 scope()->is_function_scope()); | 1407 scope()->is_function_scope()); |
| 1408 size_t entry = builder()->AllocateConstantPoolEntry(); | 1408 size_t entry = builder()->AllocateConstantPoolEntry(); |
| 1409 builder()->CreateClosure(entry, flags); | 1409 int slot_index = feedback_index(expr->LiteralFeedbackSlot()); |
| 1410 builder()->CreateClosure(entry, slot_index, flags); |
| 1410 function_literals_.push_back(std::make_pair(expr, entry)); | 1411 function_literals_.push_back(std::make_pair(expr, entry)); |
| 1411 } | 1412 } |
| 1412 | 1413 |
| 1413 void BytecodeGenerator::VisitClassLiteral(ClassLiteral* expr) { | 1414 void BytecodeGenerator::VisitClassLiteral(ClassLiteral* expr) { |
| 1414 Register constructor = VisitForRegisterValue(expr->constructor()); | 1415 Register constructor = VisitForRegisterValue(expr->constructor()); |
| 1415 { | 1416 { |
| 1416 RegisterAllocationScope register_scope(this); | 1417 RegisterAllocationScope register_scope(this); |
| 1417 RegisterList args = register_allocator()->NewRegisterList(4); | 1418 RegisterList args = register_allocator()->NewRegisterList(4); |
| 1418 VisitForAccumulatorValueOrTheHole(expr->extends()); | 1419 VisitForAccumulatorValueOrTheHole(expr->extends()); |
| 1419 builder() | 1420 builder() |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1541 expr->has_static_computed_names() | 1542 expr->has_static_computed_names() |
| 1542 ? Runtime::kInstallClassNameAccessorWithCheck | 1543 ? Runtime::kInstallClassNameAccessorWithCheck |
| 1543 : Runtime::kInstallClassNameAccessor; | 1544 : Runtime::kInstallClassNameAccessor; |
| 1544 builder()->CallRuntime(runtime_id, literal); | 1545 builder()->CallRuntime(runtime_id, literal); |
| 1545 } | 1546 } |
| 1546 } | 1547 } |
| 1547 | 1548 |
| 1548 void BytecodeGenerator::VisitNativeFunctionLiteral( | 1549 void BytecodeGenerator::VisitNativeFunctionLiteral( |
| 1549 NativeFunctionLiteral* expr) { | 1550 NativeFunctionLiteral* expr) { |
| 1550 size_t entry = builder()->AllocateConstantPoolEntry(); | 1551 size_t entry = builder()->AllocateConstantPoolEntry(); |
| 1551 builder()->CreateClosure(entry, NOT_TENURED); | 1552 int slot_index = feedback_index(expr->LiteralFeedbackSlot()); |
| 1553 builder()->CreateClosure(entry, slot_index, NOT_TENURED); |
| 1552 native_function_literals_.push_back(std::make_pair(expr, entry)); | 1554 native_function_literals_.push_back(std::make_pair(expr, entry)); |
| 1553 } | 1555 } |
| 1554 | 1556 |
| 1555 void BytecodeGenerator::VisitDoExpression(DoExpression* expr) { | 1557 void BytecodeGenerator::VisitDoExpression(DoExpression* expr) { |
| 1556 VisitBlock(expr->block()); | 1558 VisitBlock(expr->block()); |
| 1557 VisitVariableProxy(expr->result()); | 1559 VisitVariableProxy(expr->result()); |
| 1558 } | 1560 } |
| 1559 | 1561 |
| 1560 void BytecodeGenerator::VisitConditional(Conditional* expr) { | 1562 void BytecodeGenerator::VisitConditional(Conditional* expr) { |
| 1561 if (expr->condition()->ToBooleanIsTrue()) { | 1563 if (expr->condition()->ToBooleanIsTrue()) { |
| (...skipping 1763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3325 } | 3327 } |
| 3326 | 3328 |
| 3327 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { | 3329 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { |
| 3328 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict | 3330 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict |
| 3329 : Runtime::kStoreKeyedToSuper_Sloppy; | 3331 : Runtime::kStoreKeyedToSuper_Sloppy; |
| 3330 } | 3332 } |
| 3331 | 3333 |
| 3332 } // namespace interpreter | 3334 } // namespace interpreter |
| 3333 } // namespace internal | 3335 } // namespace internal |
| 3334 } // namespace v8 | 3336 } // namespace v8 |
| OLD | NEW |