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

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

Issue 12317141: Added Isolate parameter to CodeStub::GetCode(). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed whitespace. Rebased. Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | src/x64/macro-assembler-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
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 936 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 void LCodeGen::DoParameter(LParameter* instr) { 947 void LCodeGen::DoParameter(LParameter* instr) {
948 // Nothing to do. 948 // Nothing to do.
949 } 949 }
950 950
951 951
952 void LCodeGen::DoCallStub(LCallStub* instr) { 952 void LCodeGen::DoCallStub(LCallStub* instr) {
953 ASSERT(ToRegister(instr->result()).is(rax)); 953 ASSERT(ToRegister(instr->result()).is(rax));
954 switch (instr->hydrogen()->major_key()) { 954 switch (instr->hydrogen()->major_key()) {
955 case CodeStub::RegExpConstructResult: { 955 case CodeStub::RegExpConstructResult: {
956 RegExpConstructResultStub stub; 956 RegExpConstructResultStub stub;
957 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 957 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
958 break; 958 break;
959 } 959 }
960 case CodeStub::RegExpExec: { 960 case CodeStub::RegExpExec: {
961 RegExpExecStub stub; 961 RegExpExecStub stub;
962 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 962 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
963 break; 963 break;
964 } 964 }
965 case CodeStub::SubString: { 965 case CodeStub::SubString: {
966 SubStringStub stub; 966 SubStringStub stub;
967 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 967 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
968 break; 968 break;
969 } 969 }
970 case CodeStub::NumberToString: { 970 case CodeStub::NumberToString: {
971 NumberToStringStub stub; 971 NumberToStringStub stub;
972 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 972 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
973 break; 973 break;
974 } 974 }
975 case CodeStub::StringAdd: { 975 case CodeStub::StringAdd: {
976 StringAddStub stub(NO_STRING_ADD_FLAGS); 976 StringAddStub stub(NO_STRING_ADD_FLAGS);
977 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 977 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
978 break; 978 break;
979 } 979 }
980 case CodeStub::StringCompare: { 980 case CodeStub::StringCompare: {
981 StringCompareStub stub; 981 StringCompareStub stub;
982 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 982 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
983 break; 983 break;
984 } 984 }
985 case CodeStub::TranscendentalCache: { 985 case CodeStub::TranscendentalCache: {
986 TranscendentalCacheStub stub(instr->transcendental_type(), 986 TranscendentalCacheStub stub(instr->transcendental_type(),
987 TranscendentalCacheStub::TAGGED); 987 TranscendentalCacheStub::TAGGED);
988 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 988 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
989 break; 989 break;
990 } 990 }
991 default: 991 default:
992 UNREACHABLE(); 992 UNREACHABLE();
993 } 993 }
994 } 994 }
995 995
996 996
997 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) { 997 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) {
998 // Nothing to do. 998 // Nothing to do.
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
1802 } 1802 }
1803 } 1803 }
1804 1804
1805 1805
1806 void LCodeGen::DoArithmeticT(LArithmeticT* instr) { 1806 void LCodeGen::DoArithmeticT(LArithmeticT* instr) {
1807 ASSERT(ToRegister(instr->left()).is(rdx)); 1807 ASSERT(ToRegister(instr->left()).is(rdx));
1808 ASSERT(ToRegister(instr->right()).is(rax)); 1808 ASSERT(ToRegister(instr->right()).is(rax));
1809 ASSERT(ToRegister(instr->result()).is(rax)); 1809 ASSERT(ToRegister(instr->result()).is(rax));
1810 1810
1811 BinaryOpStub stub(instr->op(), NO_OVERWRITE); 1811 BinaryOpStub stub(instr->op(), NO_OVERWRITE);
1812 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 1812 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
1813 __ nop(); // Signals no inlined code. 1813 __ nop(); // Signals no inlined code.
1814 } 1814 }
1815 1815
1816 1816
1817 int LCodeGen::GetNextEmittedBlock(int block) { 1817 int LCodeGen::GetNextEmittedBlock(int block) {
1818 for (int i = block + 1; i < graph()->blocks()->length(); ++i) { 1818 for (int i = block + 1; i < graph()->blocks()->length(); ++i) {
1819 LLabel* label = chunk_->GetLabel(i); 1819 LLabel* label = chunk_->GetLabel(i);
1820 if (!label->HasReplacement()) return i; 1820 if (!label->HasReplacement()) return i;
1821 } 1821 }
1822 return -1; 1822 return -1;
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
2196 Immediate(1 << Map::kIsUndetectable)); 2196 Immediate(1 << Map::kIsUndetectable));
2197 EmitBranch(true_block, false_block, not_zero); 2197 EmitBranch(true_block, false_block, not_zero);
2198 } 2198 }
2199 2199
2200 2200
2201 void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) { 2201 void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) {
2202 Token::Value op = instr->op(); 2202 Token::Value op = instr->op();
2203 int true_block = chunk_->LookupDestination(instr->true_block_id()); 2203 int true_block = chunk_->LookupDestination(instr->true_block_id());
2204 int false_block = chunk_->LookupDestination(instr->false_block_id()); 2204 int false_block = chunk_->LookupDestination(instr->false_block_id());
2205 2205
2206 Handle<Code> ic = CompareIC::GetUninitialized(op); 2206 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op);
2207 CallCode(ic, RelocInfo::CODE_TARGET, instr); 2207 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2208 2208
2209 Condition condition = TokenToCondition(op, false); 2209 Condition condition = TokenToCondition(op, false);
2210 __ testq(rax, rax); 2210 __ testq(rax, rax);
2211 2211
2212 EmitBranch(true_block, false_block, condition); 2212 EmitBranch(true_block, false_block, condition);
2213 } 2213 }
2214 2214
2215 2215
2216 static InstanceType TestType(HHasInstanceTypeAndBranch* instr) { 2216 static InstanceType TestType(HHasInstanceTypeAndBranch* instr) {
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
2366 2366
2367 __ Cmp(FieldOperand(reg, HeapObject::kMapOffset), instr->map()); 2367 __ Cmp(FieldOperand(reg, HeapObject::kMapOffset), instr->map());
2368 EmitBranch(true_block, false_block, equal); 2368 EmitBranch(true_block, false_block, equal);
2369 } 2369 }
2370 2370
2371 2371
2372 void LCodeGen::DoInstanceOf(LInstanceOf* instr) { 2372 void LCodeGen::DoInstanceOf(LInstanceOf* instr) {
2373 InstanceofStub stub(InstanceofStub::kNoFlags); 2373 InstanceofStub stub(InstanceofStub::kNoFlags);
2374 __ push(ToRegister(instr->left())); 2374 __ push(ToRegister(instr->left()));
2375 __ push(ToRegister(instr->right())); 2375 __ push(ToRegister(instr->right()));
2376 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 2376 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
2377 Label true_value, done; 2377 Label true_value, done;
2378 __ testq(rax, rax); 2378 __ testq(rax, rax);
2379 __ j(zero, &true_value, Label::kNear); 2379 __ j(zero, &true_value, Label::kNear);
2380 __ LoadRoot(ToRegister(instr->result()), Heap::kFalseValueRootIndex); 2380 __ LoadRoot(ToRegister(instr->result()), Heap::kFalseValueRootIndex);
2381 __ jmp(&done, Label::kNear); 2381 __ jmp(&done, Label::kNear);
2382 __ bind(&true_value); 2382 __ bind(&true_value);
2383 __ LoadRoot(ToRegister(instr->result()), Heap::kTrueValueRootIndex); 2383 __ LoadRoot(ToRegister(instr->result()), Heap::kTrueValueRootIndex);
2384 __ bind(&done); 2384 __ bind(&done);
2385 } 2385 }
2386 2386
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
2465 static const int kAdditionalDelta = 10; 2465 static const int kAdditionalDelta = 10;
2466 int delta = 2466 int delta =
2467 masm_->SizeOfCodeGeneratedSince(map_check) + kAdditionalDelta; 2467 masm_->SizeOfCodeGeneratedSince(map_check) + kAdditionalDelta;
2468 ASSERT(delta >= 0); 2468 ASSERT(delta >= 0);
2469 __ push_imm32(delta); 2469 __ push_imm32(delta);
2470 2470
2471 // We are pushing three values on the stack but recording a 2471 // We are pushing three values on the stack but recording a
2472 // safepoint with two arguments because stub is going to 2472 // safepoint with two arguments because stub is going to
2473 // remove the third argument from the stack before jumping 2473 // remove the third argument from the stack before jumping
2474 // to instanceof builtin on the slow path. 2474 // to instanceof builtin on the slow path.
2475 CallCodeGeneric(stub.GetCode(), 2475 CallCodeGeneric(stub.GetCode(isolate()),
2476 RelocInfo::CODE_TARGET, 2476 RelocInfo::CODE_TARGET,
2477 instr, 2477 instr,
2478 RECORD_SAFEPOINT_WITH_REGISTERS, 2478 RECORD_SAFEPOINT_WITH_REGISTERS,
2479 2); 2479 2);
2480 ASSERT(delta == masm_->SizeOfCodeGeneratedSince(map_check)); 2480 ASSERT(delta == masm_->SizeOfCodeGeneratedSince(map_check));
2481 LEnvironment* env = instr->GetDeferredLazyDeoptimizationEnvironment(); 2481 LEnvironment* env = instr->GetDeferredLazyDeoptimizationEnvironment();
2482 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); 2482 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index());
2483 // Move result to a register that survives the end of the 2483 // Move result to a register that survives the end of the
2484 // PushSafepointRegisterScope. 2484 // PushSafepointRegisterScope.
2485 __ movq(kScratchRegister, rax); 2485 __ movq(kScratchRegister, rax);
(...skipping 14 matching lines...) Expand all
2500 Register object = ToRegister(instr->object()); 2500 Register object = ToRegister(instr->object());
2501 Register result = ToRegister(instr->result()); 2501 Register result = ToRegister(instr->result());
2502 __ movq(result, FieldOperand(object, HeapObject::kMapOffset)); 2502 __ movq(result, FieldOperand(object, HeapObject::kMapOffset));
2503 __ movzxbq(result, FieldOperand(result, Map::kInstanceSizeOffset)); 2503 __ movzxbq(result, FieldOperand(result, Map::kInstanceSizeOffset));
2504 } 2504 }
2505 2505
2506 2506
2507 void LCodeGen::DoCmpT(LCmpT* instr) { 2507 void LCodeGen::DoCmpT(LCmpT* instr) {
2508 Token::Value op = instr->op(); 2508 Token::Value op = instr->op();
2509 2509
2510 Handle<Code> ic = CompareIC::GetUninitialized(op); 2510 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op);
2511 CallCode(ic, RelocInfo::CODE_TARGET, instr); 2511 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2512 2512
2513 Condition condition = TokenToCondition(op, false); 2513 Condition condition = TokenToCondition(op, false);
2514 Label true_value, done; 2514 Label true_value, done;
2515 __ testq(rax, rax); 2515 __ testq(rax, rax);
2516 __ j(condition, &true_value, Label::kNear); 2516 __ j(condition, &true_value, Label::kNear);
2517 __ LoadRoot(ToRegister(instr->result()), Heap::kFalseValueRootIndex); 2517 __ LoadRoot(ToRegister(instr->result()), Heap::kFalseValueRootIndex);
2518 __ jmp(&done, Label::kNear); 2518 __ jmp(&done, Label::kNear);
2519 __ bind(&true_value); 2519 __ bind(&true_value);
2520 __ LoadRoot(ToRegister(instr->result()), Heap::kTrueValueRootIndex); 2520 __ LoadRoot(ToRegister(instr->result()), Heap::kTrueValueRootIndex);
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after
3734 Register temp2 = ToRegister(instr->temp2()); 3734 Register temp2 = ToRegister(instr->temp2());
3735 3735
3736 MathExpGenerator::EmitMathExp(masm(), input, result, xmm0, temp1, temp2); 3736 MathExpGenerator::EmitMathExp(masm(), input, result, xmm0, temp1, temp2);
3737 } 3737 }
3738 3738
3739 3739
3740 void LCodeGen::DoMathLog(LUnaryMathOperation* instr) { 3740 void LCodeGen::DoMathLog(LUnaryMathOperation* instr) {
3741 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); 3741 ASSERT(ToDoubleRegister(instr->result()).is(xmm1));
3742 TranscendentalCacheStub stub(TranscendentalCache::LOG, 3742 TranscendentalCacheStub stub(TranscendentalCache::LOG,
3743 TranscendentalCacheStub::UNTAGGED); 3743 TranscendentalCacheStub::UNTAGGED);
3744 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 3744 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
3745 } 3745 }
3746 3746
3747 3747
3748 void LCodeGen::DoMathTan(LUnaryMathOperation* instr) { 3748 void LCodeGen::DoMathTan(LUnaryMathOperation* instr) {
3749 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); 3749 ASSERT(ToDoubleRegister(instr->result()).is(xmm1));
3750 TranscendentalCacheStub stub(TranscendentalCache::TAN, 3750 TranscendentalCacheStub stub(TranscendentalCache::TAN,
3751 TranscendentalCacheStub::UNTAGGED); 3751 TranscendentalCacheStub::UNTAGGED);
3752 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 3752 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
3753 } 3753 }
3754 3754
3755 3755
3756 void LCodeGen::DoMathCos(LUnaryMathOperation* instr) { 3756 void LCodeGen::DoMathCos(LUnaryMathOperation* instr) {
3757 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); 3757 ASSERT(ToDoubleRegister(instr->result()).is(xmm1));
3758 TranscendentalCacheStub stub(TranscendentalCache::COS, 3758 TranscendentalCacheStub stub(TranscendentalCache::COS,
3759 TranscendentalCacheStub::UNTAGGED); 3759 TranscendentalCacheStub::UNTAGGED);
3760 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 3760 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
3761 } 3761 }
3762 3762
3763 3763
3764 void LCodeGen::DoMathSin(LUnaryMathOperation* instr) { 3764 void LCodeGen::DoMathSin(LUnaryMathOperation* instr) {
3765 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); 3765 ASSERT(ToDoubleRegister(instr->result()).is(xmm1));
3766 TranscendentalCacheStub stub(TranscendentalCache::SIN, 3766 TranscendentalCacheStub stub(TranscendentalCache::SIN,
3767 TranscendentalCacheStub::UNTAGGED); 3767 TranscendentalCacheStub::UNTAGGED);
3768 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 3768 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
3769 } 3769 }
3770 3770
3771 3771
3772 void LCodeGen::DoUnaryMathOperation(LUnaryMathOperation* instr) { 3772 void LCodeGen::DoUnaryMathOperation(LUnaryMathOperation* instr) {
3773 switch (instr->op()) { 3773 switch (instr->op()) {
3774 case kMathAbs: 3774 case kMathAbs:
3775 DoMathAbs(instr); 3775 DoMathAbs(instr);
3776 break; 3776 break;
3777 case kMathFloor: 3777 case kMathFloor:
3778 DoMathFloor(instr); 3778 DoMathFloor(instr);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
3850 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); 3850 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
3851 } 3851 }
3852 3852
3853 3853
3854 void LCodeGen::DoCallFunction(LCallFunction* instr) { 3854 void LCodeGen::DoCallFunction(LCallFunction* instr) {
3855 ASSERT(ToRegister(instr->function()).is(rdi)); 3855 ASSERT(ToRegister(instr->function()).is(rdi));
3856 ASSERT(ToRegister(instr->result()).is(rax)); 3856 ASSERT(ToRegister(instr->result()).is(rax));
3857 3857
3858 int arity = instr->arity(); 3858 int arity = instr->arity();
3859 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); 3859 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS);
3860 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 3860 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
3861 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); 3861 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
3862 } 3862 }
3863 3863
3864 3864
3865 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { 3865 void LCodeGen::DoCallGlobal(LCallGlobal* instr) {
3866 ASSERT(ToRegister(instr->result()).is(rax)); 3866 ASSERT(ToRegister(instr->result()).is(rax));
3867 int arity = instr->arity(); 3867 int arity = instr->arity();
3868 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT; 3868 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT;
3869 Handle<Code> ic = 3869 Handle<Code> ic =
3870 isolate()->stub_cache()->ComputeCallInitialize(arity, mode); 3870 isolate()->stub_cache()->ComputeCallInitialize(arity, mode);
(...skipping 12 matching lines...) Expand all
3883 RDI_UNINITIALIZED); 3883 RDI_UNINITIALIZED);
3884 } 3884 }
3885 3885
3886 3886
3887 void LCodeGen::DoCallNew(LCallNew* instr) { 3887 void LCodeGen::DoCallNew(LCallNew* instr) {
3888 ASSERT(ToRegister(instr->constructor()).is(rdi)); 3888 ASSERT(ToRegister(instr->constructor()).is(rdi));
3889 ASSERT(ToRegister(instr->result()).is(rax)); 3889 ASSERT(ToRegister(instr->result()).is(rax));
3890 3890
3891 CallConstructStub stub(NO_CALL_FUNCTION_FLAGS); 3891 CallConstructStub stub(NO_CALL_FUNCTION_FLAGS);
3892 __ Set(rax, instr->arity()); 3892 __ Set(rax, instr->arity());
3893 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr); 3893 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
3894 } 3894 }
3895 3895
3896 3896
3897 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { 3897 void LCodeGen::DoCallRuntime(LCallRuntime* instr) {
3898 CallRuntime(instr->function(), instr->arity(), instr); 3898 CallRuntime(instr->function(), instr->arity(), instr);
3899 } 3899 }
3900 3900
3901 3901
3902 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { 3902 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
3903 Register object = ToRegister(instr->object()); 3903 Register object = ToRegister(instr->object());
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
4251 Register temp = ToRegister(instr->temp()); 4251 Register temp = ToRegister(instr->temp());
4252 __ TestJSArrayForAllocationSiteInfo(object, temp); 4252 __ TestJSArrayForAllocationSiteInfo(object, temp);
4253 DeoptimizeIf(equal, instr->environment()); 4253 DeoptimizeIf(equal, instr->environment());
4254 } 4254 }
4255 4255
4256 4256
4257 void LCodeGen::DoStringAdd(LStringAdd* instr) { 4257 void LCodeGen::DoStringAdd(LStringAdd* instr) {
4258 EmitPushTaggedOperand(instr->left()); 4258 EmitPushTaggedOperand(instr->left());
4259 EmitPushTaggedOperand(instr->right()); 4259 EmitPushTaggedOperand(instr->right());
4260 StringAddStub stub(NO_STRING_CHECK_IN_STUB); 4260 StringAddStub stub(NO_STRING_CHECK_IN_STUB);
4261 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 4261 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
4262 } 4262 }
4263 4263
4264 4264
4265 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) { 4265 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) {
4266 class DeferredStringCharCodeAt: public LDeferredCode { 4266 class DeferredStringCharCodeAt: public LDeferredCode {
4267 public: 4267 public:
4268 DeferredStringCharCodeAt(LCodeGen* codegen, LStringCharCodeAt* instr) 4268 DeferredStringCharCodeAt(LCodeGen* codegen, LStringCharCodeAt* instr)
4269 : LDeferredCode(codegen), instr_(instr) { } 4269 : LDeferredCode(codegen), instr_(instr) { }
4270 virtual void Generate() { codegen()->DoDeferredStringCharCodeAt(instr_); } 4270 virtual void Generate() { codegen()->DoDeferredStringCharCodeAt(instr_); }
4271 virtual LInstruction* instr() { return instr_; } 4271 virtual LInstruction* instr() { return instr_; }
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
5126 // Pass an empty fixed array. 5126 // Pass an empty fixed array.
5127 __ Push(isolate()->factory()->empty_fixed_array()); 5127 __ Push(isolate()->factory()->empty_fixed_array());
5128 5128
5129 // Pick the right runtime function or stub to call. 5129 // Pick the right runtime function or stub to call.
5130 int length = instr->hydrogen()->length(); 5130 int length = instr->hydrogen()->length();
5131 if (instr->hydrogen()->IsCopyOnWrite()) { 5131 if (instr->hydrogen()->IsCopyOnWrite()) {
5132 ASSERT(instr->hydrogen()->depth() == 1); 5132 ASSERT(instr->hydrogen()->depth() == 1);
5133 FastCloneShallowArrayStub::Mode mode = 5133 FastCloneShallowArrayStub::Mode mode =
5134 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS; 5134 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS;
5135 FastCloneShallowArrayStub stub(mode, DONT_TRACK_ALLOCATION_SITE, length); 5135 FastCloneShallowArrayStub stub(mode, DONT_TRACK_ALLOCATION_SITE, length);
5136 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 5136 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
5137 } else if (instr->hydrogen()->depth() > 1) { 5137 } else if (instr->hydrogen()->depth() > 1) {
5138 CallRuntime(Runtime::kCreateArrayLiteral, 3, instr); 5138 CallRuntime(Runtime::kCreateArrayLiteral, 3, instr);
5139 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { 5139 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) {
5140 CallRuntime(Runtime::kCreateArrayLiteralShallow, 3, instr); 5140 CallRuntime(Runtime::kCreateArrayLiteralShallow, 3, instr);
5141 } else { 5141 } else {
5142 FastCloneShallowArrayStub::Mode mode = 5142 FastCloneShallowArrayStub::Mode mode =
5143 boilerplate_elements_kind == FAST_DOUBLE_ELEMENTS 5143 boilerplate_elements_kind == FAST_DOUBLE_ELEMENTS
5144 ? FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS 5144 ? FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS
5145 : FastCloneShallowArrayStub::CLONE_ELEMENTS; 5145 : FastCloneShallowArrayStub::CLONE_ELEMENTS;
5146 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); 5146 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length);
5147 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 5147 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
5148 } 5148 }
5149 } 5149 }
5150 5150
5151 5151
5152 void LCodeGen::EmitDeepCopy(Handle<JSObject> object, 5152 void LCodeGen::EmitDeepCopy(Handle<JSObject> object,
5153 Register result, 5153 Register result,
5154 Register source, 5154 Register source,
5155 int* offset, 5155 int* offset,
5156 AllocationSiteMode mode) { 5156 AllocationSiteMode mode) {
5157 ASSERT(!source.is(rcx)); 5157 ASSERT(!source.is(rcx));
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
5333 __ Push(Smi::FromInt(instr->hydrogen()->literal_index())); 5333 __ Push(Smi::FromInt(instr->hydrogen()->literal_index()));
5334 __ Push(constant_properties); 5334 __ Push(constant_properties);
5335 __ Push(Smi::FromInt(flags)); 5335 __ Push(Smi::FromInt(flags));
5336 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr); 5336 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr);
5337 } else { 5337 } else {
5338 __ LoadHeapObject(rax, literals); 5338 __ LoadHeapObject(rax, literals);
5339 __ Move(rbx, Smi::FromInt(instr->hydrogen()->literal_index())); 5339 __ Move(rbx, Smi::FromInt(instr->hydrogen()->literal_index()));
5340 __ Move(rcx, constant_properties); 5340 __ Move(rcx, constant_properties);
5341 __ Move(rdx, Smi::FromInt(flags)); 5341 __ Move(rdx, Smi::FromInt(flags));
5342 FastCloneShallowObjectStub stub(properties_count); 5342 FastCloneShallowObjectStub stub(properties_count);
5343 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 5343 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
5344 } 5344 }
5345 } 5345 }
5346 5346
5347 5347
5348 void LCodeGen::DoToFastProperties(LToFastProperties* instr) { 5348 void LCodeGen::DoToFastProperties(LToFastProperties* instr) {
5349 ASSERT(ToRegister(instr->value()).is(rax)); 5349 ASSERT(ToRegister(instr->value()).is(rax));
5350 __ push(rax); 5350 __ push(rax);
5351 CallRuntime(Runtime::kToFastProperties, 1, instr); 5351 CallRuntime(Runtime::kToFastProperties, 1, instr);
5352 } 5352 }
5353 5353
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
5403 5403
5404 5404
5405 void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) { 5405 void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) {
5406 // Use the fast case closure allocation code that allocates in new 5406 // Use the fast case closure allocation code that allocates in new
5407 // space for nested functions that don't need literals cloning. 5407 // space for nested functions that don't need literals cloning.
5408 Handle<SharedFunctionInfo> shared_info = instr->shared_info(); 5408 Handle<SharedFunctionInfo> shared_info = instr->shared_info();
5409 bool pretenure = instr->hydrogen()->pretenure(); 5409 bool pretenure = instr->hydrogen()->pretenure();
5410 if (!pretenure && shared_info->num_literals() == 0) { 5410 if (!pretenure && shared_info->num_literals() == 0) {
5411 FastNewClosureStub stub(shared_info->language_mode()); 5411 FastNewClosureStub stub(shared_info->language_mode());
5412 __ Push(shared_info); 5412 __ Push(shared_info);
5413 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 5413 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
5414 } else { 5414 } else {
5415 __ push(rsi); 5415 __ push(rsi);
5416 __ Push(shared_info); 5416 __ Push(shared_info);
5417 __ PushRoot(pretenure ? 5417 __ PushRoot(pretenure ?
5418 Heap::kTrueValueRootIndex : 5418 Heap::kTrueValueRootIndex :
5419 Heap::kFalseValueRootIndex); 5419 Heap::kFalseValueRootIndex);
5420 CallRuntime(Runtime::kNewClosure, 3, instr); 5420 CallRuntime(Runtime::kNewClosure, 3, instr);
5421 } 5421 }
5422 } 5422 }
5423 5423
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
5649 ASSERT(instr->HasEnvironment()); 5649 ASSERT(instr->HasEnvironment());
5650 LEnvironment* env = instr->environment(); 5650 LEnvironment* env = instr->environment();
5651 // There is no LLazyBailout instruction for stack-checks. We have to 5651 // There is no LLazyBailout instruction for stack-checks. We have to
5652 // prepare for lazy deoptimization explicitly here. 5652 // prepare for lazy deoptimization explicitly here.
5653 if (instr->hydrogen()->is_function_entry()) { 5653 if (instr->hydrogen()->is_function_entry()) {
5654 // Perform stack overflow check. 5654 // Perform stack overflow check.
5655 Label done; 5655 Label done;
5656 __ CompareRoot(rsp, Heap::kStackLimitRootIndex); 5656 __ CompareRoot(rsp, Heap::kStackLimitRootIndex);
5657 __ j(above_equal, &done, Label::kNear); 5657 __ j(above_equal, &done, Label::kNear);
5658 StackCheckStub stub; 5658 StackCheckStub stub;
5659 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 5659 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
5660 EnsureSpaceForLazyDeopt(Deoptimizer::patch_size()); 5660 EnsureSpaceForLazyDeopt(Deoptimizer::patch_size());
5661 last_lazy_deopt_pc_ = masm()->pc_offset(); 5661 last_lazy_deopt_pc_ = masm()->pc_offset();
5662 __ bind(&done); 5662 __ bind(&done);
5663 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); 5663 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt);
5664 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); 5664 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index());
5665 } else { 5665 } else {
5666 ASSERT(instr->hydrogen()->is_backwards_branch()); 5666 ASSERT(instr->hydrogen()->is_backwards_branch());
5667 // Perform stack overflow check if this goto needs it before jumping. 5667 // Perform stack overflow check if this goto needs it before jumping.
5668 DeferredStackCheck* deferred_stack_check = 5668 DeferredStackCheck* deferred_stack_check =
5669 new(zone()) DeferredStackCheck(this, instr); 5669 new(zone()) DeferredStackCheck(this, instr);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
5785 FixedArray::kHeaderSize - kPointerSize)); 5785 FixedArray::kHeaderSize - kPointerSize));
5786 __ bind(&done); 5786 __ bind(&done);
5787 } 5787 }
5788 5788
5789 5789
5790 #undef __ 5790 #undef __
5791 5791
5792 } } // namespace v8::internal 5792 } } // namespace v8::internal
5793 5793
5794 #endif // V8_TARGET_ARCH_X64 5794 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | src/x64/macro-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698