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 1381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1392 | 1392 |
1393 void BytecodeGenerator::VisitDebuggerStatement(DebuggerStatement* stmt) { | 1393 void BytecodeGenerator::VisitDebuggerStatement(DebuggerStatement* stmt) { |
1394 builder()->SetStatementPosition(stmt); | 1394 builder()->SetStatementPosition(stmt); |
1395 builder()->Debugger(); | 1395 builder()->Debugger(); |
1396 } | 1396 } |
1397 | 1397 |
1398 void BytecodeGenerator::VisitFunctionLiteral(FunctionLiteral* expr) { | 1398 void BytecodeGenerator::VisitFunctionLiteral(FunctionLiteral* expr) { |
1399 uint8_t flags = CreateClosureFlags::Encode(expr->pretenure(), | 1399 uint8_t flags = CreateClosureFlags::Encode(expr->pretenure(), |
1400 scope()->is_function_scope()); | 1400 scope()->is_function_scope()); |
1401 size_t entry = builder()->AllocateConstantPoolEntry(); | 1401 size_t entry = builder()->AllocateConstantPoolEntry(); |
1402 builder()->CreateClosure(entry, flags); | 1402 int slot_index = feedback_index(expr->LiteralFeedbackSlot()); |
| 1403 builder()->CreateClosure(entry, slot_index, flags); |
1403 function_literals_.push_back(std::make_pair(expr, entry)); | 1404 function_literals_.push_back(std::make_pair(expr, entry)); |
1404 } | 1405 } |
1405 | 1406 |
1406 void BytecodeGenerator::VisitClassLiteral(ClassLiteral* expr) { | 1407 void BytecodeGenerator::VisitClassLiteral(ClassLiteral* expr) { |
1407 VisitClassLiteralForRuntimeDefinition(expr); | 1408 VisitClassLiteralForRuntimeDefinition(expr); |
1408 | 1409 |
1409 // Load the "prototype" from the constructor. | 1410 // Load the "prototype" from the constructor. |
1410 Register literal = register_allocator()->NewRegister(); | 1411 Register literal = register_allocator()->NewRegister(); |
1411 Register prototype = register_allocator()->NewRegister(); | 1412 Register prototype = register_allocator()->NewRegister(); |
1412 FeedbackVectorSlot slot = expr->PrototypeSlot(); | 1413 FeedbackVectorSlot slot = expr->PrototypeSlot(); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1523 expr->has_static_computed_names() | 1524 expr->has_static_computed_names() |
1524 ? Runtime::kInstallClassNameAccessorWithCheck | 1525 ? Runtime::kInstallClassNameAccessorWithCheck |
1525 : Runtime::kInstallClassNameAccessor; | 1526 : Runtime::kInstallClassNameAccessor; |
1526 builder()->CallRuntime(runtime_id, literal); | 1527 builder()->CallRuntime(runtime_id, literal); |
1527 } | 1528 } |
1528 } | 1529 } |
1529 | 1530 |
1530 void BytecodeGenerator::VisitNativeFunctionLiteral( | 1531 void BytecodeGenerator::VisitNativeFunctionLiteral( |
1531 NativeFunctionLiteral* expr) { | 1532 NativeFunctionLiteral* expr) { |
1532 size_t entry = builder()->AllocateConstantPoolEntry(); | 1533 size_t entry = builder()->AllocateConstantPoolEntry(); |
1533 builder()->CreateClosure(entry, NOT_TENURED); | 1534 int slot_index = feedback_index(expr->LiteralFeedbackSlot()); |
| 1535 builder()->CreateClosure(entry, slot_index, NOT_TENURED); |
1534 native_function_literals_.push_back(std::make_pair(expr, entry)); | 1536 native_function_literals_.push_back(std::make_pair(expr, entry)); |
1535 } | 1537 } |
1536 | 1538 |
1537 void BytecodeGenerator::VisitDoExpression(DoExpression* expr) { | 1539 void BytecodeGenerator::VisitDoExpression(DoExpression* expr) { |
1538 VisitBlock(expr->block()); | 1540 VisitBlock(expr->block()); |
1539 VisitVariableProxy(expr->result()); | 1541 VisitVariableProxy(expr->result()); |
1540 } | 1542 } |
1541 | 1543 |
1542 void BytecodeGenerator::VisitConditional(Conditional* expr) { | 1544 void BytecodeGenerator::VisitConditional(Conditional* expr) { |
1543 if (expr->condition()->ToBooleanIsTrue()) { | 1545 if (expr->condition()->ToBooleanIsTrue()) { |
(...skipping 1716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3260 } | 3262 } |
3261 | 3263 |
3262 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { | 3264 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { |
3263 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict | 3265 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict |
3264 : Runtime::kStoreKeyedToSuper_Sloppy; | 3266 : Runtime::kStoreKeyedToSuper_Sloppy; |
3265 } | 3267 } |
3266 | 3268 |
3267 } // namespace interpreter | 3269 } // namespace interpreter |
3268 } // namespace internal | 3270 } // namespace internal |
3269 } // namespace v8 | 3271 } // namespace v8 |
OLD | NEW |