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 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1395 scope()->is_function_scope()); | 1395 scope()->is_function_scope()); |
1396 size_t entry = builder()->AllocateConstantPoolEntry(); | 1396 size_t entry = builder()->AllocateConstantPoolEntry(); |
1397 builder()->CreateClosure(entry, flags); | 1397 builder()->CreateClosure(entry, flags); |
1398 function_literals_.push_back(std::make_pair(expr, entry)); | 1398 function_literals_.push_back(std::make_pair(expr, entry)); |
1399 } | 1399 } |
1400 | 1400 |
1401 void BytecodeGenerator::VisitClassLiteral(ClassLiteral* expr) { | 1401 void BytecodeGenerator::VisitClassLiteral(ClassLiteral* expr) { |
1402 VisitClassLiteralForRuntimeDefinition(expr); | 1402 VisitClassLiteralForRuntimeDefinition(expr); |
1403 | 1403 |
1404 // Load the "prototype" from the constructor. | 1404 // Load the "prototype" from the constructor. |
1405 RegisterList args = register_allocator()->NewRegisterList(2); | 1405 Register literal = register_allocator()->NewRegister(); |
1406 Register literal = args[0]; | 1406 Register prototype = register_allocator()->NewRegister(); |
1407 Register prototype = args[1]; | |
1408 FeedbackVectorSlot slot = expr->PrototypeSlot(); | 1407 FeedbackVectorSlot slot = expr->PrototypeSlot(); |
1409 builder() | 1408 builder() |
1410 ->StoreAccumulatorInRegister(literal) | 1409 ->StoreAccumulatorInRegister(literal) |
1411 .LoadNamedProperty(literal, prototype_string(), feedback_index(slot)) | 1410 .LoadNamedProperty(literal, prototype_string(), feedback_index(slot)) |
1412 .StoreAccumulatorInRegister(prototype); | 1411 .StoreAccumulatorInRegister(prototype); |
1413 | 1412 |
1414 VisitClassLiteralProperties(expr, literal, prototype); | 1413 VisitClassLiteralProperties(expr, literal, prototype); |
1415 builder()->CallRuntime(Runtime::kToFastProperties, literal); | 1414 builder()->CallRuntime(Runtime::kToFastProperties, literal); |
1416 // Assign to class variable. | 1415 // Assign to class variable. |
1417 if (expr->class_variable_proxy() != nullptr) { | 1416 if (expr->class_variable_proxy() != nullptr) { |
(...skipping 1778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3196 } | 3195 } |
3197 | 3196 |
3198 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { | 3197 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { |
3199 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict | 3198 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict |
3200 : Runtime::kStoreKeyedToSuper_Sloppy; | 3199 : Runtime::kStoreKeyedToSuper_Sloppy; |
3201 } | 3200 } |
3202 | 3201 |
3203 } // namespace interpreter | 3202 } // namespace interpreter |
3204 } // namespace internal | 3203 } // namespace internal |
3205 } // namespace v8 | 3204 } // namespace v8 |
OLD | NEW |