OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved.7 | 1 // Copyright 2012 the V8 project authors. All rights reserved.7 |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 10 matching lines...) Expand all Loading... |
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #include "src/v8.h" | 28 #include "src/v8.h" |
29 | 29 |
30 #include "src/base/bits.h" | 30 #include "src/base/bits.h" |
| 31 #include "src/code-factory.h" |
31 #include "src/code-stubs.h" | 32 #include "src/code-stubs.h" |
32 #include "src/hydrogen-osr.h" | 33 #include "src/hydrogen-osr.h" |
33 #include "src/ic/stub-cache.h" | 34 #include "src/ic/stub-cache.h" |
34 #include "src/mips/lithium-codegen-mips.h" | 35 #include "src/mips/lithium-codegen-mips.h" |
35 #include "src/mips/lithium-gap-resolver-mips.h" | 36 #include "src/mips/lithium-gap-resolver-mips.h" |
36 | 37 |
37 | 38 |
38 namespace v8 { | 39 namespace v8 { |
39 namespace internal { | 40 namespace internal { |
40 | 41 |
(...skipping 1989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2030 } | 2031 } |
2031 } | 2032 } |
2032 | 2033 |
2033 | 2034 |
2034 void LCodeGen::DoArithmeticT(LArithmeticT* instr) { | 2035 void LCodeGen::DoArithmeticT(LArithmeticT* instr) { |
2035 DCHECK(ToRegister(instr->context()).is(cp)); | 2036 DCHECK(ToRegister(instr->context()).is(cp)); |
2036 DCHECK(ToRegister(instr->left()).is(a1)); | 2037 DCHECK(ToRegister(instr->left()).is(a1)); |
2037 DCHECK(ToRegister(instr->right()).is(a0)); | 2038 DCHECK(ToRegister(instr->right()).is(a0)); |
2038 DCHECK(ToRegister(instr->result()).is(v0)); | 2039 DCHECK(ToRegister(instr->result()).is(v0)); |
2039 | 2040 |
2040 BinaryOpICStub stub(isolate(), instr->op(), NO_OVERWRITE); | 2041 Handle<Code> code = |
2041 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 2042 CodeFactory::BinaryOpIC(isolate(), instr->op(), NO_OVERWRITE).code(); |
| 2043 CallCode(code, RelocInfo::CODE_TARGET, instr); |
2042 // Other arch use a nop here, to signal that there is no inlined | 2044 // Other arch use a nop here, to signal that there is no inlined |
2043 // patchable code. Mips does not need the nop, since our marker | 2045 // patchable code. Mips does not need the nop, since our marker |
2044 // instruction (andi zero_reg) will never be used in normal code. | 2046 // instruction (andi zero_reg) will never be used in normal code. |
2045 } | 2047 } |
2046 | 2048 |
2047 | 2049 |
2048 template<class InstrType> | 2050 template<class InstrType> |
2049 void LCodeGen::EmitBranch(InstrType instr, | 2051 void LCodeGen::EmitBranch(InstrType instr, |
2050 Condition condition, | 2052 Condition condition, |
2051 Register src1, | 2053 Register src1, |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2511 UNREACHABLE(); | 2513 UNREACHABLE(); |
2512 return kNoCondition; | 2514 return kNoCondition; |
2513 } | 2515 } |
2514 } | 2516 } |
2515 | 2517 |
2516 | 2518 |
2517 void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) { | 2519 void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) { |
2518 DCHECK(ToRegister(instr->context()).is(cp)); | 2520 DCHECK(ToRegister(instr->context()).is(cp)); |
2519 Token::Value op = instr->op(); | 2521 Token::Value op = instr->op(); |
2520 | 2522 |
2521 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op); | 2523 Handle<Code> ic = CodeFactory::CompareIC(isolate(), op).code(); |
2522 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2524 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2523 | 2525 |
2524 Condition condition = ComputeCompareCondition(op); | 2526 Condition condition = ComputeCompareCondition(op); |
2525 | 2527 |
2526 EmitBranch(instr, condition, v0, Operand(zero_reg)); | 2528 EmitBranch(instr, condition, v0, Operand(zero_reg)); |
2527 } | 2529 } |
2528 | 2530 |
2529 | 2531 |
2530 static InstanceType TestType(HHasInstanceTypeAndBranch* instr) { | 2532 static InstanceType TestType(HHasInstanceTypeAndBranch* instr) { |
2531 InstanceType from = instr->from(); | 2533 InstanceType from = instr->from(); |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2812 // Put the result value into the result register slot and | 2814 // Put the result value into the result register slot and |
2813 // restore all registers. | 2815 // restore all registers. |
2814 __ StoreToSafepointRegisterSlot(result, result); | 2816 __ StoreToSafepointRegisterSlot(result, result); |
2815 } | 2817 } |
2816 | 2818 |
2817 | 2819 |
2818 void LCodeGen::DoCmpT(LCmpT* instr) { | 2820 void LCodeGen::DoCmpT(LCmpT* instr) { |
2819 DCHECK(ToRegister(instr->context()).is(cp)); | 2821 DCHECK(ToRegister(instr->context()).is(cp)); |
2820 Token::Value op = instr->op(); | 2822 Token::Value op = instr->op(); |
2821 | 2823 |
2822 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op); | 2824 Handle<Code> ic = CodeFactory::CompareIC(isolate(), op).code(); |
2823 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2825 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2824 // On MIPS there is no need for a "no inlined smi code" marker (nop). | 2826 // On MIPS there is no need for a "no inlined smi code" marker (nop). |
2825 | 2827 |
2826 Condition condition = ComputeCompareCondition(op); | 2828 Condition condition = ComputeCompareCondition(op); |
2827 // A minor optimization that relies on LoadRoot always emitting one | 2829 // A minor optimization that relies on LoadRoot always emitting one |
2828 // instruction. | 2830 // instruction. |
2829 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm()); | 2831 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm()); |
2830 Label done, check; | 2832 Label done, check; |
2831 __ Branch(USE_DELAY_SLOT, &done, condition, v0, Operand(zero_reg)); | 2833 __ Branch(USE_DELAY_SLOT, &done, condition, v0, Operand(zero_reg)); |
2832 __ bind(&check); | 2834 __ bind(&check); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2906 DCHECK(ToRegister(instr->context()).is(cp)); | 2908 DCHECK(ToRegister(instr->context()).is(cp)); |
2907 DCHECK(ToRegister(instr->global_object()) | 2909 DCHECK(ToRegister(instr->global_object()) |
2908 .is(LoadDescriptor::ReceiverRegister())); | 2910 .is(LoadDescriptor::ReceiverRegister())); |
2909 DCHECK(ToRegister(instr->result()).is(v0)); | 2911 DCHECK(ToRegister(instr->result()).is(v0)); |
2910 | 2912 |
2911 __ li(LoadDescriptor::NameRegister(), Operand(instr->name())); | 2913 __ li(LoadDescriptor::NameRegister(), Operand(instr->name())); |
2912 if (FLAG_vector_ics) { | 2914 if (FLAG_vector_ics) { |
2913 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); | 2915 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); |
2914 } | 2916 } |
2915 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; | 2917 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; |
2916 Handle<Code> ic = LoadIC::initialize_stub(isolate(), mode); | 2918 Handle<Code> ic = CodeFactory::LoadIC(isolate(), mode).code(); |
2917 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2919 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2918 } | 2920 } |
2919 | 2921 |
2920 | 2922 |
2921 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { | 2923 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { |
2922 Register value = ToRegister(instr->value()); | 2924 Register value = ToRegister(instr->value()); |
2923 Register cell = scratch0(); | 2925 Register cell = scratch0(); |
2924 | 2926 |
2925 // Load the cell. | 2927 // Load the cell. |
2926 __ li(cell, Operand(instr->hydrogen()->cell().handle())); | 2928 __ li(cell, Operand(instr->hydrogen()->cell().handle())); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3033 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { | 3035 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { |
3034 DCHECK(ToRegister(instr->context()).is(cp)); | 3036 DCHECK(ToRegister(instr->context()).is(cp)); |
3035 DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister())); | 3037 DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister())); |
3036 DCHECK(ToRegister(instr->result()).is(v0)); | 3038 DCHECK(ToRegister(instr->result()).is(v0)); |
3037 | 3039 |
3038 // Name is always in a2. | 3040 // Name is always in a2. |
3039 __ li(LoadDescriptor::NameRegister(), Operand(instr->name())); | 3041 __ li(LoadDescriptor::NameRegister(), Operand(instr->name())); |
3040 if (FLAG_vector_ics) { | 3042 if (FLAG_vector_ics) { |
3041 EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr); | 3043 EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr); |
3042 } | 3044 } |
3043 Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL); | 3045 Handle<Code> ic = CodeFactory::LoadIC(isolate(), NOT_CONTEXTUAL).code(); |
3044 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3046 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3045 } | 3047 } |
3046 | 3048 |
3047 | 3049 |
3048 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { | 3050 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { |
3049 Register scratch = scratch0(); | 3051 Register scratch = scratch0(); |
3050 Register function = ToRegister(instr->function()); | 3052 Register function = ToRegister(instr->function()); |
3051 Register result = ToRegister(instr->result()); | 3053 Register result = ToRegister(instr->result()); |
3052 | 3054 |
3053 // Get the prototype or initial map from the function. | 3055 // Get the prototype or initial map from the function. |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3341 | 3343 |
3342 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { | 3344 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { |
3343 DCHECK(ToRegister(instr->context()).is(cp)); | 3345 DCHECK(ToRegister(instr->context()).is(cp)); |
3344 DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister())); | 3346 DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister())); |
3345 DCHECK(ToRegister(instr->key()).is(LoadDescriptor::NameRegister())); | 3347 DCHECK(ToRegister(instr->key()).is(LoadDescriptor::NameRegister())); |
3346 | 3348 |
3347 if (FLAG_vector_ics) { | 3349 if (FLAG_vector_ics) { |
3348 EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr); | 3350 EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr); |
3349 } | 3351 } |
3350 | 3352 |
3351 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); | 3353 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); |
3352 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3354 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3353 } | 3355 } |
3354 | 3356 |
3355 | 3357 |
3356 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) { | 3358 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) { |
3357 Register scratch = scratch0(); | 3359 Register scratch = scratch0(); |
3358 Register temp = scratch1(); | 3360 Register temp = scratch1(); |
3359 Register result = ToRegister(instr->result()); | 3361 Register result = ToRegister(instr->result()); |
3360 | 3362 |
3361 if (instr->hydrogen()->from_inlined()) { | 3363 if (instr->hydrogen()->from_inlined()) { |
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4415 } | 4417 } |
4416 } | 4418 } |
4417 | 4419 |
4418 | 4420 |
4419 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { | 4421 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
4420 DCHECK(ToRegister(instr->context()).is(cp)); | 4422 DCHECK(ToRegister(instr->context()).is(cp)); |
4421 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); | 4423 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); |
4422 DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister())); | 4424 DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister())); |
4423 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); | 4425 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); |
4424 | 4426 |
4425 Handle<Code> ic = (instr->strict_mode() == STRICT) | 4427 Handle<Code> ic = |
4426 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() | 4428 CodeFactory::KeyedStoreIC(isolate(), instr->strict_mode()).code(); |
4427 : isolate()->builtins()->KeyedStoreIC_Initialize(); | |
4428 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4429 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
4429 } | 4430 } |
4430 | 4431 |
4431 | 4432 |
4432 void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) { | 4433 void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) { |
4433 Register object_reg = ToRegister(instr->object()); | 4434 Register object_reg = ToRegister(instr->object()); |
4434 Register scratch = scratch0(); | 4435 Register scratch = scratch0(); |
4435 | 4436 |
4436 Handle<Map> from_map = instr->original_map(); | 4437 Handle<Map> from_map = instr->original_map(); |
4437 Handle<Map> to_map = instr->transitioned_map(); | 4438 Handle<Map> to_map = instr->transitioned_map(); |
(...skipping 1490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5928 __ li(at, scope_info); | 5929 __ li(at, scope_info); |
5929 __ Push(at, ToRegister(instr->function())); | 5930 __ Push(at, ToRegister(instr->function())); |
5930 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5931 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5931 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5932 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5932 } | 5933 } |
5933 | 5934 |
5934 | 5935 |
5935 #undef __ | 5936 #undef __ |
5936 | 5937 |
5937 } } // namespace v8::internal | 5938 } } // namespace v8::internal |
OLD | NEW |