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/arm/lithium-codegen-arm.h" | 7 #include "src/arm/lithium-codegen-arm.h" |
8 #include "src/arm/lithium-gap-resolver-arm.h" | 8 #include "src/arm/lithium-gap-resolver-arm.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/code-factory.h" |
10 #include "src/code-stubs.h" | 11 #include "src/code-stubs.h" |
11 #include "src/hydrogen-osr.h" | 12 #include "src/hydrogen-osr.h" |
12 #include "src/ic/stub-cache.h" | 13 #include "src/ic/stub-cache.h" |
13 | 14 |
14 namespace v8 { | 15 namespace v8 { |
15 namespace internal { | 16 namespace internal { |
16 | 17 |
17 | 18 |
18 class SafepointGenerator FINAL : public CallWrapper { | 19 class SafepointGenerator FINAL : public CallWrapper { |
19 public: | 20 public: |
(...skipping 2146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2166 } | 2167 } |
2167 } | 2168 } |
2168 | 2169 |
2169 | 2170 |
2170 void LCodeGen::DoArithmeticT(LArithmeticT* instr) { | 2171 void LCodeGen::DoArithmeticT(LArithmeticT* instr) { |
2171 DCHECK(ToRegister(instr->context()).is(cp)); | 2172 DCHECK(ToRegister(instr->context()).is(cp)); |
2172 DCHECK(ToRegister(instr->left()).is(r1)); | 2173 DCHECK(ToRegister(instr->left()).is(r1)); |
2173 DCHECK(ToRegister(instr->right()).is(r0)); | 2174 DCHECK(ToRegister(instr->right()).is(r0)); |
2174 DCHECK(ToRegister(instr->result()).is(r0)); | 2175 DCHECK(ToRegister(instr->result()).is(r0)); |
2175 | 2176 |
2176 BinaryOpICStub stub(isolate(), instr->op(), NO_OVERWRITE); | 2177 Handle<Code> code = |
| 2178 CodeFactory::BinaryOpIC(isolate(), instr->op(), NO_OVERWRITE).code(); |
2177 // Block literal pool emission to ensure nop indicating no inlined smi code | 2179 // Block literal pool emission to ensure nop indicating no inlined smi code |
2178 // is in the correct position. | 2180 // is in the correct position. |
2179 Assembler::BlockConstPoolScope block_const_pool(masm()); | 2181 Assembler::BlockConstPoolScope block_const_pool(masm()); |
2180 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 2182 CallCode(code, RelocInfo::CODE_TARGET, instr); |
2181 } | 2183 } |
2182 | 2184 |
2183 | 2185 |
2184 template<class InstrType> | 2186 template<class InstrType> |
2185 void LCodeGen::EmitBranch(InstrType instr, Condition condition) { | 2187 void LCodeGen::EmitBranch(InstrType instr, Condition condition) { |
2186 int left_block = instr->TrueDestination(chunk_); | 2188 int left_block = instr->TrueDestination(chunk_); |
2187 int right_block = instr->FalseDestination(chunk_); | 2189 int right_block = instr->FalseDestination(chunk_); |
2188 | 2190 |
2189 int next_block = GetNextEmittedBlock(); | 2191 int next_block = GetNextEmittedBlock(); |
2190 | 2192 |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2602 UNREACHABLE(); | 2604 UNREACHABLE(); |
2603 return kNoCondition; | 2605 return kNoCondition; |
2604 } | 2606 } |
2605 } | 2607 } |
2606 | 2608 |
2607 | 2609 |
2608 void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) { | 2610 void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) { |
2609 DCHECK(ToRegister(instr->context()).is(cp)); | 2611 DCHECK(ToRegister(instr->context()).is(cp)); |
2610 Token::Value op = instr->op(); | 2612 Token::Value op = instr->op(); |
2611 | 2613 |
2612 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op); | 2614 Handle<Code> ic = CodeFactory::CompareIC(isolate(), op).code(); |
2613 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2615 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2614 // This instruction also signals no smi code inlined. | 2616 // This instruction also signals no smi code inlined. |
2615 __ cmp(r0, Operand::Zero()); | 2617 __ cmp(r0, Operand::Zero()); |
2616 | 2618 |
2617 Condition condition = ComputeCompareCondition(op); | 2619 Condition condition = ComputeCompareCondition(op); |
2618 | 2620 |
2619 EmitBranch(instr, condition); | 2621 EmitBranch(instr, condition); |
2620 } | 2622 } |
2621 | 2623 |
2622 | 2624 |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2918 // Put the result value (r0) into the result register slot and | 2920 // Put the result value (r0) into the result register slot and |
2919 // restore all registers. | 2921 // restore all registers. |
2920 __ StoreToSafepointRegisterSlot(r0, ToRegister(instr->result())); | 2922 __ StoreToSafepointRegisterSlot(r0, ToRegister(instr->result())); |
2921 } | 2923 } |
2922 | 2924 |
2923 | 2925 |
2924 void LCodeGen::DoCmpT(LCmpT* instr) { | 2926 void LCodeGen::DoCmpT(LCmpT* instr) { |
2925 DCHECK(ToRegister(instr->context()).is(cp)); | 2927 DCHECK(ToRegister(instr->context()).is(cp)); |
2926 Token::Value op = instr->op(); | 2928 Token::Value op = instr->op(); |
2927 | 2929 |
2928 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op); | 2930 Handle<Code> ic = CodeFactory::CompareIC(isolate(), op).code(); |
2929 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2931 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2930 // This instruction also signals no smi code inlined. | 2932 // This instruction also signals no smi code inlined. |
2931 __ cmp(r0, Operand::Zero()); | 2933 __ cmp(r0, Operand::Zero()); |
2932 | 2934 |
2933 Condition condition = ComputeCompareCondition(op); | 2935 Condition condition = ComputeCompareCondition(op); |
2934 __ LoadRoot(ToRegister(instr->result()), | 2936 __ LoadRoot(ToRegister(instr->result()), |
2935 Heap::kTrueValueRootIndex, | 2937 Heap::kTrueValueRootIndex, |
2936 condition); | 2938 condition); |
2937 __ LoadRoot(ToRegister(instr->result()), | 2939 __ LoadRoot(ToRegister(instr->result()), |
2938 Heap::kFalseValueRootIndex, | 2940 Heap::kFalseValueRootIndex, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3009 DCHECK(ToRegister(instr->context()).is(cp)); | 3011 DCHECK(ToRegister(instr->context()).is(cp)); |
3010 DCHECK(ToRegister(instr->global_object()) | 3012 DCHECK(ToRegister(instr->global_object()) |
3011 .is(LoadDescriptor::ReceiverRegister())); | 3013 .is(LoadDescriptor::ReceiverRegister())); |
3012 DCHECK(ToRegister(instr->result()).is(r0)); | 3014 DCHECK(ToRegister(instr->result()).is(r0)); |
3013 | 3015 |
3014 __ mov(LoadDescriptor::NameRegister(), Operand(instr->name())); | 3016 __ mov(LoadDescriptor::NameRegister(), Operand(instr->name())); |
3015 if (FLAG_vector_ics) { | 3017 if (FLAG_vector_ics) { |
3016 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); | 3018 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); |
3017 } | 3019 } |
3018 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; | 3020 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; |
3019 Handle<Code> ic = LoadIC::initialize_stub(isolate(), mode); | 3021 Handle<Code> ic = CodeFactory::LoadIC(isolate(), mode).code(); |
3020 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3022 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3021 } | 3023 } |
3022 | 3024 |
3023 | 3025 |
3024 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { | 3026 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { |
3025 Register value = ToRegister(instr->value()); | 3027 Register value = ToRegister(instr->value()); |
3026 Register cell = scratch0(); | 3028 Register cell = scratch0(); |
3027 | 3029 |
3028 // Load the cell. | 3030 // Load the cell. |
3029 __ mov(cell, Operand(instr->hydrogen()->cell().handle())); | 3031 __ mov(cell, Operand(instr->hydrogen()->cell().handle())); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3131 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { | 3133 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { |
3132 DCHECK(ToRegister(instr->context()).is(cp)); | 3134 DCHECK(ToRegister(instr->context()).is(cp)); |
3133 DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister())); | 3135 DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister())); |
3134 DCHECK(ToRegister(instr->result()).is(r0)); | 3136 DCHECK(ToRegister(instr->result()).is(r0)); |
3135 | 3137 |
3136 // Name is always in r2. | 3138 // Name is always in r2. |
3137 __ mov(LoadDescriptor::NameRegister(), Operand(instr->name())); | 3139 __ mov(LoadDescriptor::NameRegister(), Operand(instr->name())); |
3138 if (FLAG_vector_ics) { | 3140 if (FLAG_vector_ics) { |
3139 EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr); | 3141 EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr); |
3140 } | 3142 } |
3141 Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL); | 3143 Handle<Code> ic = CodeFactory::LoadIC(isolate(), NOT_CONTEXTUAL).code(); |
3142 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); | 3144 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); |
3143 } | 3145 } |
3144 | 3146 |
3145 | 3147 |
3146 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { | 3148 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { |
3147 Register scratch = scratch0(); | 3149 Register scratch = scratch0(); |
3148 Register function = ToRegister(instr->function()); | 3150 Register function = ToRegister(instr->function()); |
3149 Register result = ToRegister(instr->result()); | 3151 Register result = ToRegister(instr->result()); |
3150 | 3152 |
3151 // Get the prototype or initial map from the function. | 3153 // Get the prototype or initial map from the function. |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3422 | 3424 |
3423 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { | 3425 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { |
3424 DCHECK(ToRegister(instr->context()).is(cp)); | 3426 DCHECK(ToRegister(instr->context()).is(cp)); |
3425 DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister())); | 3427 DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister())); |
3426 DCHECK(ToRegister(instr->key()).is(LoadDescriptor::NameRegister())); | 3428 DCHECK(ToRegister(instr->key()).is(LoadDescriptor::NameRegister())); |
3427 | 3429 |
3428 if (FLAG_vector_ics) { | 3430 if (FLAG_vector_ics) { |
3429 EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr); | 3431 EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr); |
3430 } | 3432 } |
3431 | 3433 |
3432 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); | 3434 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); |
3433 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); | 3435 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); |
3434 } | 3436 } |
3435 | 3437 |
3436 | 3438 |
3437 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) { | 3439 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) { |
3438 Register scratch = scratch0(); | 3440 Register scratch = scratch0(); |
3439 Register result = ToRegister(instr->result()); | 3441 Register result = ToRegister(instr->result()); |
3440 | 3442 |
3441 if (instr->hydrogen()->from_inlined()) { | 3443 if (instr->hydrogen()->from_inlined()) { |
3442 __ sub(result, sp, Operand(2 * kPointerSize)); | 3444 __ sub(result, sp, Operand(2 * kPointerSize)); |
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4449 } | 4451 } |
4450 } | 4452 } |
4451 | 4453 |
4452 | 4454 |
4453 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { | 4455 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
4454 DCHECK(ToRegister(instr->context()).is(cp)); | 4456 DCHECK(ToRegister(instr->context()).is(cp)); |
4455 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); | 4457 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); |
4456 DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister())); | 4458 DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister())); |
4457 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); | 4459 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); |
4458 | 4460 |
4459 Handle<Code> ic = instr->strict_mode() == STRICT | 4461 Handle<Code> ic = |
4460 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() | 4462 CodeFactory::KeyedStoreIC(isolate(), instr->strict_mode()).code(); |
4461 : isolate()->builtins()->KeyedStoreIC_Initialize(); | |
4462 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); | 4463 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); |
4463 } | 4464 } |
4464 | 4465 |
4465 | 4466 |
4466 void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) { | 4467 void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) { |
4467 Register object_reg = ToRegister(instr->object()); | 4468 Register object_reg = ToRegister(instr->object()); |
4468 Register scratch = scratch0(); | 4469 Register scratch = scratch0(); |
4469 | 4470 |
4470 Handle<Map> from_map = instr->original_map(); | 4471 Handle<Map> from_map = instr->original_map(); |
4471 Handle<Map> to_map = instr->transitioned_map(); | 4472 Handle<Map> to_map = instr->transitioned_map(); |
(...skipping 1438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5910 __ Push(scope_info); | 5911 __ Push(scope_info); |
5911 __ push(ToRegister(instr->function())); | 5912 __ push(ToRegister(instr->function())); |
5912 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5913 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5913 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5914 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5914 } | 5915 } |
5915 | 5916 |
5916 | 5917 |
5917 #undef __ | 5918 #undef __ |
5918 | 5919 |
5919 } } // namespace v8::internal | 5920 } } // namespace v8::internal |
OLD | NEW |