Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Side by Side Diff: src/x87/lithium-codegen-x87.cc

Issue 567953002: X87: Eliminate Turbofan shims with CodeFactory (Closed) Base URL: https://github.com/v8/v8.git@bleeding_edge
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/x87/full-codegen-x87.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #if V8_TARGET_ARCH_X87 7 #if V8_TARGET_ARCH_X87
8 8
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/codegen.h" 12 #include "src/codegen.h"
12 #include "src/deoptimizer.h" 13 #include "src/deoptimizer.h"
13 #include "src/hydrogen-osr.h" 14 #include "src/hydrogen-osr.h"
14 #include "src/ic/stub-cache.h" 15 #include "src/ic/stub-cache.h"
15 #include "src/x87/lithium-codegen-x87.h" 16 #include "src/x87/lithium-codegen-x87.h"
16 17
17 namespace v8 { 18 namespace v8 {
18 namespace internal { 19 namespace internal {
19 20
(...skipping 2144 matching lines...) Expand 10 before | Expand all | Expand 10 after
2164 } 2165 }
2165 } 2166 }
2166 2167
2167 2168
2168 void LCodeGen::DoArithmeticT(LArithmeticT* instr) { 2169 void LCodeGen::DoArithmeticT(LArithmeticT* instr) {
2169 DCHECK(ToRegister(instr->context()).is(esi)); 2170 DCHECK(ToRegister(instr->context()).is(esi));
2170 DCHECK(ToRegister(instr->left()).is(edx)); 2171 DCHECK(ToRegister(instr->left()).is(edx));
2171 DCHECK(ToRegister(instr->right()).is(eax)); 2172 DCHECK(ToRegister(instr->right()).is(eax));
2172 DCHECK(ToRegister(instr->result()).is(eax)); 2173 DCHECK(ToRegister(instr->result()).is(eax));
2173 2174
2174 BinaryOpICStub stub(isolate(), instr->op(), NO_OVERWRITE); 2175 Handle<Code> code =
2175 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 2176 CodeFactory::BinaryOpIC(isolate(), instr->op(), NO_OVERWRITE).code();
2177 CallCode(code, RelocInfo::CODE_TARGET, instr);
2176 } 2178 }
2177 2179
2178 2180
2179 template<class InstrType> 2181 template<class InstrType>
2180 void LCodeGen::EmitBranch(InstrType instr, Condition cc) { 2182 void LCodeGen::EmitBranch(InstrType instr, Condition cc) {
2181 int left_block = instr->TrueDestination(chunk_); 2183 int left_block = instr->TrueDestination(chunk_);
2182 int right_block = instr->FalseDestination(chunk_); 2184 int right_block = instr->FalseDestination(chunk_);
2183 2185
2184 int next_block = GetNextEmittedBlock(); 2186 int next_block = GetNextEmittedBlock();
2185 2187
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
2587 default: 2589 default:
2588 UNREACHABLE(); 2590 UNREACHABLE();
2589 return no_condition; 2591 return no_condition;
2590 } 2592 }
2591 } 2593 }
2592 2594
2593 2595
2594 void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) { 2596 void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) {
2595 Token::Value op = instr->op(); 2597 Token::Value op = instr->op();
2596 2598
2597 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op); 2599 Handle<Code> ic = CodeFactory::CompareIC(isolate(), op).code();
2598 CallCode(ic, RelocInfo::CODE_TARGET, instr); 2600 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2599 2601
2600 Condition condition = ComputeCompareCondition(op); 2602 Condition condition = ComputeCompareCondition(op);
2601 __ test(eax, Operand(eax)); 2603 __ test(eax, Operand(eax));
2602 2604
2603 EmitBranch(instr, condition); 2605 EmitBranch(instr, condition);
2604 } 2606 }
2605 2607
2606 2608
2607 static InstanceType TestType(HHasInstanceTypeAndBranch* instr) { 2609 static InstanceType TestType(HHasInstanceTypeAndBranch* instr) {
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
2859 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); 2861 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index());
2860 2862
2861 // Put the result value into the eax slot and restore all registers. 2863 // Put the result value into the eax slot and restore all registers.
2862 __ StoreToSafepointRegisterSlot(eax, eax); 2864 __ StoreToSafepointRegisterSlot(eax, eax);
2863 } 2865 }
2864 2866
2865 2867
2866 void LCodeGen::DoCmpT(LCmpT* instr) { 2868 void LCodeGen::DoCmpT(LCmpT* instr) {
2867 Token::Value op = instr->op(); 2869 Token::Value op = instr->op();
2868 2870
2869 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op); 2871 Handle<Code> ic = CodeFactory::CompareIC(isolate(), op).code();
2870 CallCode(ic, RelocInfo::CODE_TARGET, instr); 2872 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2871 2873
2872 Condition condition = ComputeCompareCondition(op); 2874 Condition condition = ComputeCompareCondition(op);
2873 Label true_value, done; 2875 Label true_value, done;
2874 __ test(eax, Operand(eax)); 2876 __ test(eax, Operand(eax));
2875 __ j(condition, &true_value, Label::kNear); 2877 __ j(condition, &true_value, Label::kNear);
2876 __ mov(ToRegister(instr->result()), factory()->false_value()); 2878 __ mov(ToRegister(instr->result()), factory()->false_value());
2877 __ jmp(&done, Label::kNear); 2879 __ jmp(&done, Label::kNear);
2878 __ bind(&true_value); 2880 __ bind(&true_value);
2879 __ mov(ToRegister(instr->result()), factory()->true_value()); 2881 __ mov(ToRegister(instr->result()), factory()->true_value());
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
2982 DCHECK(ToRegister(instr->context()).is(esi)); 2984 DCHECK(ToRegister(instr->context()).is(esi));
2983 DCHECK(ToRegister(instr->global_object()) 2985 DCHECK(ToRegister(instr->global_object())
2984 .is(LoadDescriptor::ReceiverRegister())); 2986 .is(LoadDescriptor::ReceiverRegister()));
2985 DCHECK(ToRegister(instr->result()).is(eax)); 2987 DCHECK(ToRegister(instr->result()).is(eax));
2986 2988
2987 __ mov(LoadDescriptor::NameRegister(), instr->name()); 2989 __ mov(LoadDescriptor::NameRegister(), instr->name());
2988 if (FLAG_vector_ics) { 2990 if (FLAG_vector_ics) {
2989 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); 2991 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr);
2990 } 2992 }
2991 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; 2993 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL;
2992 Handle<Code> ic = LoadIC::initialize_stub(isolate(), mode); 2994 Handle<Code> ic = CodeFactory::LoadIC(isolate(), mode).code();
2993 CallCode(ic, RelocInfo::CODE_TARGET, instr); 2995 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2994 } 2996 }
2995 2997
2996 2998
2997 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { 2999 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) {
2998 Register value = ToRegister(instr->value()); 3000 Register value = ToRegister(instr->value());
2999 Handle<PropertyCell> cell_handle = instr->hydrogen()->cell().handle(); 3001 Handle<PropertyCell> cell_handle = instr->hydrogen()->cell().handle();
3000 3002
3001 // If the cell we are storing to contains the hole it could have 3003 // If the cell we are storing to contains the hole it could have
3002 // been deleted from the property dictionary. In that case, we need 3004 // been deleted from the property dictionary. In that case, we need
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
3116 3118
3117 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { 3119 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) {
3118 DCHECK(ToRegister(instr->context()).is(esi)); 3120 DCHECK(ToRegister(instr->context()).is(esi));
3119 DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister())); 3121 DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister()));
3120 DCHECK(ToRegister(instr->result()).is(eax)); 3122 DCHECK(ToRegister(instr->result()).is(eax));
3121 3123
3122 __ mov(LoadDescriptor::NameRegister(), instr->name()); 3124 __ mov(LoadDescriptor::NameRegister(), instr->name());
3123 if (FLAG_vector_ics) { 3125 if (FLAG_vector_ics) {
3124 EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr); 3126 EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr);
3125 } 3127 }
3126 Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL); 3128 Handle<Code> ic = CodeFactory::LoadIC(isolate(), NOT_CONTEXTUAL).code();
3127 CallCode(ic, RelocInfo::CODE_TARGET, instr); 3129 CallCode(ic, RelocInfo::CODE_TARGET, instr);
3128 } 3130 }
3129 3131
3130 3132
3131 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { 3133 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) {
3132 Register function = ToRegister(instr->function()); 3134 Register function = ToRegister(instr->function());
3133 Register temp = ToRegister(instr->temp()); 3135 Register temp = ToRegister(instr->temp());
3134 Register result = ToRegister(instr->result()); 3136 Register result = ToRegister(instr->result());
3135 3137
3136 // Get the prototype or initial map from the function. 3138 // Get the prototype or initial map from the function.
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
3339 3341
3340 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { 3342 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) {
3341 DCHECK(ToRegister(instr->context()).is(esi)); 3343 DCHECK(ToRegister(instr->context()).is(esi));
3342 DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister())); 3344 DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister()));
3343 DCHECK(ToRegister(instr->key()).is(LoadDescriptor::NameRegister())); 3345 DCHECK(ToRegister(instr->key()).is(LoadDescriptor::NameRegister()));
3344 3346
3345 if (FLAG_vector_ics) { 3347 if (FLAG_vector_ics) {
3346 EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr); 3348 EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr);
3347 } 3349 }
3348 3350
3349 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); 3351 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code();
3350 CallCode(ic, RelocInfo::CODE_TARGET, instr); 3352 CallCode(ic, RelocInfo::CODE_TARGET, instr);
3351 } 3353 }
3352 3354
3353 3355
3354 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) { 3356 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) {
3355 Register result = ToRegister(instr->result()); 3357 Register result = ToRegister(instr->result());
3356 3358
3357 if (instr->hydrogen()->from_inlined()) { 3359 if (instr->hydrogen()->from_inlined()) {
3358 __ lea(result, Operand(esp, -2 * kPointerSize)); 3360 __ lea(result, Operand(esp, -2 * kPointerSize));
3359 } else { 3361 } else {
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
4209 } 4211 }
4210 } 4212 }
4211 4213
4212 4214
4213 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { 4215 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
4214 DCHECK(ToRegister(instr->context()).is(esi)); 4216 DCHECK(ToRegister(instr->context()).is(esi));
4215 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); 4217 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister()));
4216 DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister())); 4218 DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister()));
4217 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); 4219 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister()));
4218 4220
4219 Handle<Code> ic = instr->strict_mode() == STRICT 4221 Handle<Code> ic =
4220 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() 4222 CodeFactory::KeyedStoreIC(isolate(), instr->strict_mode()).code();
4221 : isolate()->builtins()->KeyedStoreIC_Initialize();
4222 CallCode(ic, RelocInfo::CODE_TARGET, instr); 4223 CallCode(ic, RelocInfo::CODE_TARGET, instr);
4223 } 4224 }
4224 4225
4225 4226
4226 void LCodeGen::DoTrapAllocationMemento(LTrapAllocationMemento* instr) { 4227 void LCodeGen::DoTrapAllocationMemento(LTrapAllocationMemento* instr) {
4227 Register object = ToRegister(instr->object()); 4228 Register object = ToRegister(instr->object());
4228 Register temp = ToRegister(instr->temp()); 4229 Register temp = ToRegister(instr->temp());
4229 Label no_memento_found; 4230 Label no_memento_found;
4230 __ TestJSArrayForAllocationMemento(object, temp, &no_memento_found); 4231 __ TestJSArrayForAllocationMemento(object, temp, &no_memento_found);
4231 DeoptimizeIf(equal, instr->environment()); 4232 DeoptimizeIf(equal, instr->environment());
(...skipping 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after
5727 CallRuntime(Runtime::kPushBlockContext, 2, instr); 5728 CallRuntime(Runtime::kPushBlockContext, 2, instr);
5728 RecordSafepoint(Safepoint::kNoLazyDeopt); 5729 RecordSafepoint(Safepoint::kNoLazyDeopt);
5729 } 5730 }
5730 5731
5731 5732
5732 #undef __ 5733 #undef __
5733 5734
5734 } } // namespace v8::internal 5735 } } // namespace v8::internal
5735 5736
5736 #endif // V8_TARGET_ARCH_X87 5737 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x87/full-codegen-x87.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698