| 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 | 8 |
| 9 #include "src/ast/prettyprinter.h" | 9 #include "src/ast/prettyprinter.h" |
| 10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 Node* src_value = __ LoadRegister(src_index); | 384 Node* src_value = __ LoadRegister(src_index); |
| 385 Node* dst_index = __ BytecodeOperandReg(1); | 385 Node* dst_index = __ BytecodeOperandReg(1); |
| 386 __ StoreRegister(src_value, dst_index); | 386 __ StoreRegister(src_value, dst_index); |
| 387 __ Dispatch(); | 387 __ Dispatch(); |
| 388 } | 388 } |
| 389 | 389 |
| 390 Node* Interpreter::BuildLoadGlobal(Callable ic, | 390 Node* Interpreter::BuildLoadGlobal(Callable ic, |
| 391 InterpreterAssembler* assembler) { | 391 InterpreterAssembler* assembler) { |
| 392 // Get the global object. | 392 // Get the global object. |
| 393 Node* context = __ GetContext(); | 393 Node* context = __ GetContext(); |
| 394 Node* native_context = | |
| 395 __ LoadContextSlot(context, Context::NATIVE_CONTEXT_INDEX); | |
| 396 Node* global = __ LoadContextSlot(native_context, Context::EXTENSION_INDEX); | |
| 397 | 394 |
| 398 // Load the global via the LoadIC. | 395 // Load the global via the LoadGlobalIC. |
| 399 Node* code_target = __ HeapConstant(ic.code()); | 396 Node* code_target = __ HeapConstant(ic.code()); |
| 400 Node* constant_index = __ BytecodeOperandIdx(0); | 397 Node* raw_slot = __ BytecodeOperandIdx(0); |
| 401 Node* name = __ LoadConstantPoolEntry(constant_index); | |
| 402 Node* raw_slot = __ BytecodeOperandIdx(1); | |
| 403 Node* smi_slot = __ SmiTag(raw_slot); | 398 Node* smi_slot = __ SmiTag(raw_slot); |
| 404 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); | 399 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
| 405 return __ CallStub(ic.descriptor(), code_target, context, global, name, | 400 return __ CallStub(ic.descriptor(), code_target, context, smi_slot, |
| 406 smi_slot, type_feedback_vector); | 401 type_feedback_vector); |
| 407 } | 402 } |
| 408 | 403 |
| 409 // LdaGlobal <name_index> <slot> | 404 // LdaGlobal <slot> |
| 410 // | 405 // |
| 411 // Load the global with name in constant pool entry <name_index> into the | 406 // Load the global with name in constant pool entry <name_index> into the |
| 412 // accumulator using FeedBackVector slot <slot> outside of a typeof. | 407 // accumulator using FeedBackVector slot <slot> outside of a typeof. |
| 413 void Interpreter::DoLdaGlobal(InterpreterAssembler* assembler) { | 408 void Interpreter::DoLdaGlobal(InterpreterAssembler* assembler) { |
| 414 Callable ic = | 409 Callable ic = |
| 415 CodeFactory::LoadGlobalICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF); | 410 CodeFactory::LoadGlobalICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF); |
| 416 Node* result = BuildLoadGlobal(ic, assembler); | 411 Node* result = BuildLoadGlobal(ic, assembler); |
| 417 __ SetAccumulator(result); | 412 __ SetAccumulator(result); |
| 418 __ Dispatch(); | 413 __ Dispatch(); |
| 419 } | 414 } |
| 420 | 415 |
| 421 // LdrGlobal <name_index> <slot> <reg> | 416 // LdrGlobal <slot> <reg> |
| 422 // | 417 // |
| 423 // Load the global with name in constant pool entry <name_index> into | 418 // Load the global with name in constant pool entry <name_index> into |
| 424 // register <reg> using FeedBackVector slot <slot> outside of a typeof. | 419 // register <reg> using FeedBackVector slot <slot> outside of a typeof. |
| 425 void Interpreter::DoLdrGlobal(InterpreterAssembler* assembler) { | 420 void Interpreter::DoLdrGlobal(InterpreterAssembler* assembler) { |
| 426 Callable ic = | 421 Callable ic = |
| 427 CodeFactory::LoadGlobalICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF); | 422 CodeFactory::LoadGlobalICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF); |
| 428 Node* result = BuildLoadGlobal(ic, assembler); | 423 Node* result = BuildLoadGlobal(ic, assembler); |
| 429 Node* destination = __ BytecodeOperandReg(2); | 424 Node* destination = __ BytecodeOperandReg(1); |
| 430 __ StoreRegister(result, destination); | 425 __ StoreRegister(result, destination); |
| 431 __ Dispatch(); | 426 __ Dispatch(); |
| 432 } | 427 } |
| 433 | 428 |
| 434 // LdaGlobalInsideTypeof <name_index> <slot> | 429 // LdaGlobalInsideTypeof <slot> |
| 435 // | 430 // |
| 436 // Load the global with name in constant pool entry <name_index> into the | 431 // Load the global with name in constant pool entry <name_index> into the |
| 437 // accumulator using FeedBackVector slot <slot> inside of a typeof. | 432 // accumulator using FeedBackVector slot <slot> inside of a typeof. |
| 438 void Interpreter::DoLdaGlobalInsideTypeof(InterpreterAssembler* assembler) { | 433 void Interpreter::DoLdaGlobalInsideTypeof(InterpreterAssembler* assembler) { |
| 439 Callable ic = | 434 Callable ic = |
| 440 CodeFactory::LoadGlobalICInOptimizedCode(isolate_, INSIDE_TYPEOF); | 435 CodeFactory::LoadGlobalICInOptimizedCode(isolate_, INSIDE_TYPEOF); |
| 441 Node* result = BuildLoadGlobal(ic, assembler); | 436 Node* result = BuildLoadGlobal(ic, assembler); |
| 442 __ SetAccumulator(result); | 437 __ SetAccumulator(result); |
| 443 __ Dispatch(); | 438 __ Dispatch(); |
| 444 } | 439 } |
| (...skipping 1404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1849 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 1844 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
| 1850 __ SmiTag(new_state)); | 1845 __ SmiTag(new_state)); |
| 1851 __ SetAccumulator(old_state); | 1846 __ SetAccumulator(old_state); |
| 1852 | 1847 |
| 1853 __ Dispatch(); | 1848 __ Dispatch(); |
| 1854 } | 1849 } |
| 1855 | 1850 |
| 1856 } // namespace interpreter | 1851 } // namespace interpreter |
| 1857 } // namespace internal | 1852 } // namespace internal |
| 1858 } // namespace v8 | 1853 } // namespace v8 |
| OLD | NEW |