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/interpreter.h" | 5 #include "src/interpreter/interpreter.h" |
6 | 6 |
7 #include <fstream> | 7 #include <fstream> |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
(...skipping 2338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2349 | 2349 |
2350 Node* result = | 2350 Node* result = |
2351 __ CallRuntime(Runtime::kCreateObjectLiteral, context, closure, | 2351 __ CallRuntime(Runtime::kCreateObjectLiteral, context, closure, |
2352 literal_index, constant_elements, flags); | 2352 literal_index, constant_elements, flags); |
2353 __ StoreRegister(result, __ BytecodeOperandReg(3)); | 2353 __ StoreRegister(result, __ BytecodeOperandReg(3)); |
2354 // TODO(klaasb) build a single dispatch once the call is inlined | 2354 // TODO(klaasb) build a single dispatch once the call is inlined |
2355 __ Dispatch(); | 2355 __ Dispatch(); |
2356 } | 2356 } |
2357 } | 2357 } |
2358 | 2358 |
2359 // CreateClosure <index> <tenured> | 2359 // CreateClosure <index> <slot> <tenured> |
2360 // | 2360 // |
2361 // Creates a new closure for SharedFunctionInfo at position |index| in the | 2361 // Creates a new closure for SharedFunctionInfo at position |index| in the |
2362 // constant pool and with the PretenureFlag <tenured>. | 2362 // constant pool and with the PretenureFlag <tenured>. |
2363 void Interpreter::DoCreateClosure(InterpreterAssembler* assembler) { | 2363 void Interpreter::DoCreateClosure(InterpreterAssembler* assembler) { |
2364 Node* index = __ BytecodeOperandIdx(0); | 2364 Node* index = __ BytecodeOperandIdx(0); |
2365 Node* shared = __ LoadConstantPoolEntry(index); | 2365 Node* shared = __ LoadConstantPoolEntry(index); |
2366 Node* flags = __ BytecodeOperandFlag(1); | 2366 Node* flags = __ BytecodeOperandFlag(2); |
2367 Node* context = __ GetContext(); | 2367 Node* context = __ GetContext(); |
2368 | 2368 |
2369 Label call_runtime(assembler, Label::kDeferred); | 2369 Label call_runtime(assembler, Label::kDeferred); |
2370 Node* fast_new_closure = __ Word32And( | 2370 Node* fast_new_closure = __ Word32And( |
2371 flags, __ Int32Constant(CreateClosureFlags::FastNewClosureBit::kMask)); | 2371 flags, __ Int32Constant(CreateClosureFlags::FastNewClosureBit::kMask)); |
2372 __ GotoUnless(fast_new_closure, &call_runtime); | 2372 __ GotoUnless(fast_new_closure, &call_runtime); |
2373 __ SetAccumulator(FastNewClosureStub::Generate(assembler, shared, context)); | 2373 Node* vector_index = __ BytecodeOperandIdx(1); |
| 2374 vector_index = __ SmiTag(vector_index); |
| 2375 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
| 2376 __ SetAccumulator(FastNewClosureStub::Generate( |
| 2377 assembler, shared, type_feedback_vector, vector_index, context)); |
2374 __ Dispatch(); | 2378 __ Dispatch(); |
2375 | 2379 |
2376 __ Bind(&call_runtime); | 2380 __ Bind(&call_runtime); |
2377 { | 2381 { |
2378 STATIC_ASSERT(CreateClosureFlags::PretenuredBit::kShift == 0); | 2382 STATIC_ASSERT(CreateClosureFlags::PretenuredBit::kShift == 0); |
2379 Node* tenured_raw = __ Word32And( | 2383 Node* tenured_raw = __ Word32And( |
2380 flags, __ Int32Constant(CreateClosureFlags::PretenuredBit::kMask)); | 2384 flags, __ Int32Constant(CreateClosureFlags::PretenuredBit::kMask)); |
2381 Node* tenured = __ SmiTag(tenured_raw); | 2385 Node* tenured = __ SmiTag(tenured_raw); |
2382 Node* result = __ CallRuntime(Runtime::kInterpreterNewClosure, context, | 2386 type_feedback_vector = __ LoadTypeFeedbackVector(); |
2383 shared, tenured); | 2387 vector_index = __ BytecodeOperandIdx(1); |
| 2388 vector_index = __ SmiTag(vector_index); |
| 2389 Node* result = |
| 2390 __ CallRuntime(Runtime::kInterpreterNewClosure, context, shared, |
| 2391 type_feedback_vector, vector_index, tenured); |
2384 __ SetAccumulator(result); | 2392 __ SetAccumulator(result); |
2385 __ Dispatch(); | 2393 __ Dispatch(); |
2386 } | 2394 } |
2387 } | 2395 } |
2388 | 2396 |
2389 // CreateBlockContext <index> | 2397 // CreateBlockContext <index> |
2390 // | 2398 // |
2391 // Creates a new block context with the scope info constant at |index| and the | 2399 // Creates a new block context with the scope info constant at |index| and the |
2392 // closure in the accumulator. | 2400 // closure in the accumulator. |
2393 void Interpreter::DoCreateBlockContext(InterpreterAssembler* assembler) { | 2401 void Interpreter::DoCreateBlockContext(InterpreterAssembler* assembler) { |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2866 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 2874 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
2867 __ SmiTag(new_state)); | 2875 __ SmiTag(new_state)); |
2868 __ SetAccumulator(old_state); | 2876 __ SetAccumulator(old_state); |
2869 | 2877 |
2870 __ Dispatch(); | 2878 __ Dispatch(); |
2871 } | 2879 } |
2872 | 2880 |
2873 } // namespace interpreter | 2881 } // namespace interpreter |
2874 } // namespace internal | 2882 } // namespace internal |
2875 } // namespace v8 | 2883 } // namespace v8 |
OLD | NEW |