OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
| 7 #include "src/code-factory.h" |
7 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
8 #include "src/hydrogen-osr.h" | 9 #include "src/hydrogen-osr.h" |
9 #include "src/ic/stub-cache.h" | 10 #include "src/ic/stub-cache.h" |
10 #include "src/mips64/lithium-codegen-mips64.h" | 11 #include "src/mips64/lithium-codegen-mips64.h" |
11 #include "src/mips64/lithium-gap-resolver-mips64.h" | 12 #include "src/mips64/lithium-gap-resolver-mips64.h" |
12 | 13 |
13 namespace v8 { | 14 namespace v8 { |
14 namespace internal { | 15 namespace internal { |
15 | 16 |
16 | 17 |
(...skipping 1988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2005 } | 2006 } |
2006 } | 2007 } |
2007 | 2008 |
2008 | 2009 |
2009 void LCodeGen::DoArithmeticT(LArithmeticT* instr) { | 2010 void LCodeGen::DoArithmeticT(LArithmeticT* instr) { |
2010 DCHECK(ToRegister(instr->context()).is(cp)); | 2011 DCHECK(ToRegister(instr->context()).is(cp)); |
2011 DCHECK(ToRegister(instr->left()).is(a1)); | 2012 DCHECK(ToRegister(instr->left()).is(a1)); |
2012 DCHECK(ToRegister(instr->right()).is(a0)); | 2013 DCHECK(ToRegister(instr->right()).is(a0)); |
2013 DCHECK(ToRegister(instr->result()).is(v0)); | 2014 DCHECK(ToRegister(instr->result()).is(v0)); |
2014 | 2015 |
2015 BinaryOpICStub stub(isolate(), instr->op(), NO_OVERWRITE); | 2016 Handle<Code> code = |
2016 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 2017 CodeFactory::BinaryOpIC(isolate(), instr->op(), NO_OVERWRITE).code(); |
| 2018 CallCode(code, RelocInfo::CODE_TARGET, instr); |
2017 // Other arch use a nop here, to signal that there is no inlined | 2019 // Other arch use a nop here, to signal that there is no inlined |
2018 // patchable code. Mips does not need the nop, since our marker | 2020 // patchable code. Mips does not need the nop, since our marker |
2019 // instruction (andi zero_reg) will never be used in normal code. | 2021 // instruction (andi zero_reg) will never be used in normal code. |
2020 } | 2022 } |
2021 | 2023 |
2022 | 2024 |
2023 template<class InstrType> | 2025 template<class InstrType> |
2024 void LCodeGen::EmitBranch(InstrType instr, | 2026 void LCodeGen::EmitBranch(InstrType instr, |
2025 Condition condition, | 2027 Condition condition, |
2026 Register src1, | 2028 Register src1, |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2488 UNREACHABLE(); | 2490 UNREACHABLE(); |
2489 return kNoCondition; | 2491 return kNoCondition; |
2490 } | 2492 } |
2491 } | 2493 } |
2492 | 2494 |
2493 | 2495 |
2494 void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) { | 2496 void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) { |
2495 DCHECK(ToRegister(instr->context()).is(cp)); | 2497 DCHECK(ToRegister(instr->context()).is(cp)); |
2496 Token::Value op = instr->op(); | 2498 Token::Value op = instr->op(); |
2497 | 2499 |
2498 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op); | 2500 Handle<Code> ic = CodeFactory::CompareIC(isolate(), op).code(); |
2499 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2501 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2500 | 2502 |
2501 Condition condition = ComputeCompareCondition(op); | 2503 Condition condition = ComputeCompareCondition(op); |
2502 | 2504 |
2503 EmitBranch(instr, condition, v0, Operand(zero_reg)); | 2505 EmitBranch(instr, condition, v0, Operand(zero_reg)); |
2504 } | 2506 } |
2505 | 2507 |
2506 | 2508 |
2507 static InstanceType TestType(HHasInstanceTypeAndBranch* instr) { | 2509 static InstanceType TestType(HHasInstanceTypeAndBranch* instr) { |
2508 InstanceType from = instr->from(); | 2510 InstanceType from = instr->from(); |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2789 // Put the result value into the result register slot and | 2791 // Put the result value into the result register slot and |
2790 // restore all registers. | 2792 // restore all registers. |
2791 __ StoreToSafepointRegisterSlot(result, result); | 2793 __ StoreToSafepointRegisterSlot(result, result); |
2792 } | 2794 } |
2793 | 2795 |
2794 | 2796 |
2795 void LCodeGen::DoCmpT(LCmpT* instr) { | 2797 void LCodeGen::DoCmpT(LCmpT* instr) { |
2796 DCHECK(ToRegister(instr->context()).is(cp)); | 2798 DCHECK(ToRegister(instr->context()).is(cp)); |
2797 Token::Value op = instr->op(); | 2799 Token::Value op = instr->op(); |
2798 | 2800 |
2799 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op); | 2801 Handle<Code> ic = CodeFactory::CompareIC(isolate(), op).code(); |
2800 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2802 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2801 // On MIPS there is no need for a "no inlined smi code" marker (nop). | 2803 // On MIPS there is no need for a "no inlined smi code" marker (nop). |
2802 | 2804 |
2803 Condition condition = ComputeCompareCondition(op); | 2805 Condition condition = ComputeCompareCondition(op); |
2804 // A minor optimization that relies on LoadRoot always emitting one | 2806 // A minor optimization that relies on LoadRoot always emitting one |
2805 // instruction. | 2807 // instruction. |
2806 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm()); | 2808 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm()); |
2807 Label done, check; | 2809 Label done, check; |
2808 __ Branch(USE_DELAY_SLOT, &done, condition, v0, Operand(zero_reg)); | 2810 __ Branch(USE_DELAY_SLOT, &done, condition, v0, Operand(zero_reg)); |
2809 __ bind(&check); | 2811 __ bind(&check); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2883 DCHECK(ToRegister(instr->context()).is(cp)); | 2885 DCHECK(ToRegister(instr->context()).is(cp)); |
2884 DCHECK(ToRegister(instr->global_object()) | 2886 DCHECK(ToRegister(instr->global_object()) |
2885 .is(LoadDescriptor::ReceiverRegister())); | 2887 .is(LoadDescriptor::ReceiverRegister())); |
2886 DCHECK(ToRegister(instr->result()).is(v0)); | 2888 DCHECK(ToRegister(instr->result()).is(v0)); |
2887 | 2889 |
2888 __ li(LoadDescriptor::NameRegister(), Operand(instr->name())); | 2890 __ li(LoadDescriptor::NameRegister(), Operand(instr->name())); |
2889 if (FLAG_vector_ics) { | 2891 if (FLAG_vector_ics) { |
2890 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); | 2892 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); |
2891 } | 2893 } |
2892 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; | 2894 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; |
2893 Handle<Code> ic = LoadIC::initialize_stub(isolate(), mode); | 2895 Handle<Code> ic = CodeFactory::LoadIC(isolate(), mode).code(); |
2894 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2896 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2895 } | 2897 } |
2896 | 2898 |
2897 | 2899 |
2898 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { | 2900 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { |
2899 Register value = ToRegister(instr->value()); | 2901 Register value = ToRegister(instr->value()); |
2900 Register cell = scratch0(); | 2902 Register cell = scratch0(); |
2901 | 2903 |
2902 // Load the cell. | 2904 // Load the cell. |
2903 __ li(cell, Operand(instr->hydrogen()->cell().handle())); | 2905 __ li(cell, Operand(instr->hydrogen()->cell().handle())); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3024 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { | 3026 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { |
3025 DCHECK(ToRegister(instr->context()).is(cp)); | 3027 DCHECK(ToRegister(instr->context()).is(cp)); |
3026 DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister())); | 3028 DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister())); |
3027 DCHECK(ToRegister(instr->result()).is(v0)); | 3029 DCHECK(ToRegister(instr->result()).is(v0)); |
3028 | 3030 |
3029 // Name is always in a2. | 3031 // Name is always in a2. |
3030 __ li(LoadDescriptor::NameRegister(), Operand(instr->name())); | 3032 __ li(LoadDescriptor::NameRegister(), Operand(instr->name())); |
3031 if (FLAG_vector_ics) { | 3033 if (FLAG_vector_ics) { |
3032 EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr); | 3034 EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr); |
3033 } | 3035 } |
3034 Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL); | 3036 Handle<Code> ic = CodeFactory::LoadIC(isolate(), NOT_CONTEXTUAL).code(); |
3035 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3037 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3036 } | 3038 } |
3037 | 3039 |
3038 | 3040 |
3039 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { | 3041 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { |
3040 Register scratch = scratch0(); | 3042 Register scratch = scratch0(); |
3041 Register function = ToRegister(instr->function()); | 3043 Register function = ToRegister(instr->function()); |
3042 Register result = ToRegister(instr->result()); | 3044 Register result = ToRegister(instr->result()); |
3043 | 3045 |
3044 // Get the prototype or initial map from the function. | 3046 // Get the prototype or initial map from the function. |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3373 | 3375 |
3374 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { | 3376 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { |
3375 DCHECK(ToRegister(instr->context()).is(cp)); | 3377 DCHECK(ToRegister(instr->context()).is(cp)); |
3376 DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister())); | 3378 DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister())); |
3377 DCHECK(ToRegister(instr->key()).is(LoadDescriptor::NameRegister())); | 3379 DCHECK(ToRegister(instr->key()).is(LoadDescriptor::NameRegister())); |
3378 | 3380 |
3379 if (FLAG_vector_ics) { | 3381 if (FLAG_vector_ics) { |
3380 EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr); | 3382 EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr); |
3381 } | 3383 } |
3382 | 3384 |
3383 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); | 3385 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); |
3384 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3386 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3385 } | 3387 } |
3386 | 3388 |
3387 | 3389 |
3388 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) { | 3390 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) { |
3389 Register scratch = scratch0(); | 3391 Register scratch = scratch0(); |
3390 Register temp = scratch1(); | 3392 Register temp = scratch1(); |
3391 Register result = ToRegister(instr->result()); | 3393 Register result = ToRegister(instr->result()); |
3392 | 3394 |
3393 if (instr->hydrogen()->from_inlined()) { | 3395 if (instr->hydrogen()->from_inlined()) { |
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4486 } | 4488 } |
4487 } | 4489 } |
4488 | 4490 |
4489 | 4491 |
4490 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { | 4492 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
4491 DCHECK(ToRegister(instr->context()).is(cp)); | 4493 DCHECK(ToRegister(instr->context()).is(cp)); |
4492 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); | 4494 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); |
4493 DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister())); | 4495 DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister())); |
4494 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); | 4496 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); |
4495 | 4497 |
4496 Handle<Code> ic = (instr->strict_mode() == STRICT) | 4498 Handle<Code> ic = |
4497 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() | 4499 CodeFactory::KeyedStoreIC(isolate(), instr->strict_mode()).code(); |
4498 : isolate()->builtins()->KeyedStoreIC_Initialize(); | |
4499 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4500 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
4500 } | 4501 } |
4501 | 4502 |
4502 | 4503 |
4503 void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) { | 4504 void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) { |
4504 Register object_reg = ToRegister(instr->object()); | 4505 Register object_reg = ToRegister(instr->object()); |
4505 Register scratch = scratch0(); | 4506 Register scratch = scratch0(); |
4506 | 4507 |
4507 Handle<Map> from_map = instr->original_map(); | 4508 Handle<Map> from_map = instr->original_map(); |
4508 Handle<Map> to_map = instr->transitioned_map(); | 4509 Handle<Map> to_map = instr->transitioned_map(); |
(...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5966 __ li(at, scope_info); | 5967 __ li(at, scope_info); |
5967 __ Push(at, ToRegister(instr->function())); | 5968 __ Push(at, ToRegister(instr->function())); |
5968 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5969 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5969 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5970 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5970 } | 5971 } |
5971 | 5972 |
5972 | 5973 |
5973 #undef __ | 5974 #undef __ |
5974 | 5975 |
5975 } } // namespace v8::internal | 5976 } } // namespace v8::internal |
OLD | NEW |