| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1081 // Nothing to do. | 1081 // Nothing to do. |
| 1082 } | 1082 } |
| 1083 | 1083 |
| 1084 | 1084 |
| 1085 void LCodeGen::DoCallStub(LCallStub* instr) { | 1085 void LCodeGen::DoCallStub(LCallStub* instr) { |
| 1086 ASSERT(ToRegister(instr->context()).is(esi)); | 1086 ASSERT(ToRegister(instr->context()).is(esi)); |
| 1087 ASSERT(ToRegister(instr->result()).is(eax)); | 1087 ASSERT(ToRegister(instr->result()).is(eax)); |
| 1088 switch (instr->hydrogen()->major_key()) { | 1088 switch (instr->hydrogen()->major_key()) { |
| 1089 case CodeStub::RegExpConstructResult: { | 1089 case CodeStub::RegExpConstructResult: { |
| 1090 RegExpConstructResultStub stub; | 1090 RegExpConstructResultStub stub; |
| 1091 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 1091 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| 1092 break; | 1092 break; |
| 1093 } | 1093 } |
| 1094 case CodeStub::RegExpExec: { | 1094 case CodeStub::RegExpExec: { |
| 1095 RegExpExecStub stub; | 1095 RegExpExecStub stub; |
| 1096 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 1096 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| 1097 break; | 1097 break; |
| 1098 } | 1098 } |
| 1099 case CodeStub::SubString: { | 1099 case CodeStub::SubString: { |
| 1100 SubStringStub stub; | 1100 SubStringStub stub; |
| 1101 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 1101 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| 1102 break; | 1102 break; |
| 1103 } | 1103 } |
| 1104 case CodeStub::NumberToString: { | 1104 case CodeStub::NumberToString: { |
| 1105 NumberToStringStub stub; | 1105 NumberToStringStub stub; |
| 1106 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 1106 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| 1107 break; | 1107 break; |
| 1108 } | 1108 } |
| 1109 case CodeStub::StringAdd: { | 1109 case CodeStub::StringAdd: { |
| 1110 StringAddStub stub(NO_STRING_ADD_FLAGS); | 1110 StringAddStub stub(NO_STRING_ADD_FLAGS); |
| 1111 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 1111 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| 1112 break; | 1112 break; |
| 1113 } | 1113 } |
| 1114 case CodeStub::StringCompare: { | 1114 case CodeStub::StringCompare: { |
| 1115 StringCompareStub stub; | 1115 StringCompareStub stub; |
| 1116 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 1116 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| 1117 break; | 1117 break; |
| 1118 } | 1118 } |
| 1119 case CodeStub::TranscendentalCache: { | 1119 case CodeStub::TranscendentalCache: { |
| 1120 TranscendentalCacheStub stub(instr->transcendental_type(), | 1120 TranscendentalCacheStub stub(instr->transcendental_type(), |
| 1121 TranscendentalCacheStub::TAGGED); | 1121 TranscendentalCacheStub::TAGGED); |
| 1122 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 1122 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| 1123 break; | 1123 break; |
| 1124 } | 1124 } |
| 1125 default: | 1125 default: |
| 1126 UNREACHABLE(); | 1126 UNREACHABLE(); |
| 1127 } | 1127 } |
| 1128 } | 1128 } |
| 1129 | 1129 |
| 1130 | 1130 |
| 1131 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) { | 1131 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) { |
| 1132 // Nothing to do. | 1132 // Nothing to do. |
| (...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1963 } | 1963 } |
| 1964 | 1964 |
| 1965 | 1965 |
| 1966 void LCodeGen::DoArithmeticT(LArithmeticT* instr) { | 1966 void LCodeGen::DoArithmeticT(LArithmeticT* instr) { |
| 1967 ASSERT(ToRegister(instr->context()).is(esi)); | 1967 ASSERT(ToRegister(instr->context()).is(esi)); |
| 1968 ASSERT(ToRegister(instr->left()).is(edx)); | 1968 ASSERT(ToRegister(instr->left()).is(edx)); |
| 1969 ASSERT(ToRegister(instr->right()).is(eax)); | 1969 ASSERT(ToRegister(instr->right()).is(eax)); |
| 1970 ASSERT(ToRegister(instr->result()).is(eax)); | 1970 ASSERT(ToRegister(instr->result()).is(eax)); |
| 1971 | 1971 |
| 1972 BinaryOpStub stub(instr->op(), NO_OVERWRITE); | 1972 BinaryOpStub stub(instr->op(), NO_OVERWRITE); |
| 1973 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 1973 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| 1974 __ nop(); // Signals no inlined code. | 1974 __ nop(); // Signals no inlined code. |
| 1975 } | 1975 } |
| 1976 | 1976 |
| 1977 | 1977 |
| 1978 int LCodeGen::GetNextEmittedBlock(int block) { | 1978 int LCodeGen::GetNextEmittedBlock(int block) { |
| 1979 for (int i = block + 1; i < graph()->blocks()->length(); ++i) { | 1979 for (int i = block + 1; i < graph()->blocks()->length(); ++i) { |
| 1980 LLabel* label = chunk_->GetLabel(i); | 1980 LLabel* label = chunk_->GetLabel(i); |
| 1981 if (!label->HasReplacement()) return i; | 1981 if (!label->HasReplacement()) return i; |
| 1982 } | 1982 } |
| 1983 return -1; | 1983 return -1; |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2365 return no_condition; | 2365 return no_condition; |
| 2366 } | 2366 } |
| 2367 } | 2367 } |
| 2368 | 2368 |
| 2369 | 2369 |
| 2370 void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) { | 2370 void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) { |
| 2371 Token::Value op = instr->op(); | 2371 Token::Value op = instr->op(); |
| 2372 int true_block = chunk_->LookupDestination(instr->true_block_id()); | 2372 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
| 2373 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 2373 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
| 2374 | 2374 |
| 2375 Handle<Code> ic = CompareIC::GetUninitialized(op); | 2375 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op); |
| 2376 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2376 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 2377 | 2377 |
| 2378 Condition condition = ComputeCompareCondition(op); | 2378 Condition condition = ComputeCompareCondition(op); |
| 2379 __ test(eax, Operand(eax)); | 2379 __ test(eax, Operand(eax)); |
| 2380 | 2380 |
| 2381 EmitBranch(true_block, false_block, condition); | 2381 EmitBranch(true_block, false_block, condition); |
| 2382 } | 2382 } |
| 2383 | 2383 |
| 2384 | 2384 |
| 2385 static InstanceType TestType(HHasInstanceTypeAndBranch* instr) { | 2385 static InstanceType TestType(HHasInstanceTypeAndBranch* instr) { |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2533 | 2533 |
| 2534 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), instr->map()); | 2534 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), instr->map()); |
| 2535 EmitBranch(true_block, false_block, equal); | 2535 EmitBranch(true_block, false_block, equal); |
| 2536 } | 2536 } |
| 2537 | 2537 |
| 2538 | 2538 |
| 2539 void LCodeGen::DoInstanceOf(LInstanceOf* instr) { | 2539 void LCodeGen::DoInstanceOf(LInstanceOf* instr) { |
| 2540 // Object and function are in fixed registers defined by the stub. | 2540 // Object and function are in fixed registers defined by the stub. |
| 2541 ASSERT(ToRegister(instr->context()).is(esi)); | 2541 ASSERT(ToRegister(instr->context()).is(esi)); |
| 2542 InstanceofStub stub(InstanceofStub::kArgsInRegisters); | 2542 InstanceofStub stub(InstanceofStub::kArgsInRegisters); |
| 2543 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 2543 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| 2544 | 2544 |
| 2545 Label true_value, done; | 2545 Label true_value, done; |
| 2546 __ test(eax, Operand(eax)); | 2546 __ test(eax, Operand(eax)); |
| 2547 __ j(zero, &true_value, Label::kNear); | 2547 __ j(zero, &true_value, Label::kNear); |
| 2548 __ mov(ToRegister(instr->result()), factory()->false_value()); | 2548 __ mov(ToRegister(instr->result()), factory()->false_value()); |
| 2549 __ jmp(&done, Label::kNear); | 2549 __ jmp(&done, Label::kNear); |
| 2550 __ bind(&true_value); | 2550 __ bind(&true_value); |
| 2551 __ mov(ToRegister(instr->result()), factory()->true_value()); | 2551 __ mov(ToRegister(instr->result()), factory()->true_value()); |
| 2552 __ bind(&done); | 2552 __ bind(&done); |
| 2553 } | 2553 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2634 // register which is pushed last by PushSafepointRegisters as top of the | 2634 // register which is pushed last by PushSafepointRegisters as top of the |
| 2635 // stack is used to pass the offset to the location of the map check to | 2635 // stack is used to pass the offset to the location of the map check to |
| 2636 // the stub. | 2636 // the stub. |
| 2637 Register temp = ToRegister(instr->temp()); | 2637 Register temp = ToRegister(instr->temp()); |
| 2638 ASSERT(MacroAssembler::SafepointRegisterStackIndex(temp) == 0); | 2638 ASSERT(MacroAssembler::SafepointRegisterStackIndex(temp) == 0); |
| 2639 __ LoadHeapObject(InstanceofStub::right(), instr->function()); | 2639 __ LoadHeapObject(InstanceofStub::right(), instr->function()); |
| 2640 static const int kAdditionalDelta = 13; | 2640 static const int kAdditionalDelta = 13; |
| 2641 int delta = masm_->SizeOfCodeGeneratedSince(map_check) + kAdditionalDelta; | 2641 int delta = masm_->SizeOfCodeGeneratedSince(map_check) + kAdditionalDelta; |
| 2642 __ mov(temp, Immediate(delta)); | 2642 __ mov(temp, Immediate(delta)); |
| 2643 __ StoreToSafepointRegisterSlot(temp, temp); | 2643 __ StoreToSafepointRegisterSlot(temp, temp); |
| 2644 CallCodeGeneric(stub.GetCode(), | 2644 CallCodeGeneric(stub.GetCode(isolate()), |
| 2645 RelocInfo::CODE_TARGET, | 2645 RelocInfo::CODE_TARGET, |
| 2646 instr, | 2646 instr, |
| 2647 RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); | 2647 RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); |
| 2648 // Get the deoptimization index of the LLazyBailout-environment that | 2648 // Get the deoptimization index of the LLazyBailout-environment that |
| 2649 // corresponds to this instruction. | 2649 // corresponds to this instruction. |
| 2650 LEnvironment* env = instr->GetDeferredLazyDeoptimizationEnvironment(); | 2650 LEnvironment* env = instr->GetDeferredLazyDeoptimizationEnvironment(); |
| 2651 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); | 2651 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); |
| 2652 | 2652 |
| 2653 // Put the result value into the eax slot and restore all registers. | 2653 // Put the result value into the eax slot and restore all registers. |
| 2654 __ StoreToSafepointRegisterSlot(eax, eax); | 2654 __ StoreToSafepointRegisterSlot(eax, eax); |
| 2655 } | 2655 } |
| 2656 | 2656 |
| 2657 | 2657 |
| 2658 void LCodeGen::DoInstanceSize(LInstanceSize* instr) { | 2658 void LCodeGen::DoInstanceSize(LInstanceSize* instr) { |
| 2659 Register object = ToRegister(instr->object()); | 2659 Register object = ToRegister(instr->object()); |
| 2660 Register result = ToRegister(instr->result()); | 2660 Register result = ToRegister(instr->result()); |
| 2661 __ mov(result, FieldOperand(object, HeapObject::kMapOffset)); | 2661 __ mov(result, FieldOperand(object, HeapObject::kMapOffset)); |
| 2662 __ movzx_b(result, FieldOperand(result, Map::kInstanceSizeOffset)); | 2662 __ movzx_b(result, FieldOperand(result, Map::kInstanceSizeOffset)); |
| 2663 } | 2663 } |
| 2664 | 2664 |
| 2665 | 2665 |
| 2666 void LCodeGen::DoCmpT(LCmpT* instr) { | 2666 void LCodeGen::DoCmpT(LCmpT* instr) { |
| 2667 Token::Value op = instr->op(); | 2667 Token::Value op = instr->op(); |
| 2668 | 2668 |
| 2669 Handle<Code> ic = CompareIC::GetUninitialized(op); | 2669 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op); |
| 2670 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2670 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 2671 | 2671 |
| 2672 Condition condition = ComputeCompareCondition(op); | 2672 Condition condition = ComputeCompareCondition(op); |
| 2673 Label true_value, done; | 2673 Label true_value, done; |
| 2674 __ test(eax, Operand(eax)); | 2674 __ test(eax, Operand(eax)); |
| 2675 __ j(condition, &true_value, Label::kNear); | 2675 __ j(condition, &true_value, Label::kNear); |
| 2676 __ mov(ToRegister(instr->result()), factory()->false_value()); | 2676 __ mov(ToRegister(instr->result()), factory()->false_value()); |
| 2677 __ jmp(&done, Label::kNear); | 2677 __ jmp(&done, Label::kNear); |
| 2678 __ bind(&true_value); | 2678 __ bind(&true_value); |
| 2679 __ mov(ToRegister(instr->result()), factory()->true_value()); | 2679 __ mov(ToRegister(instr->result()), factory()->true_value()); |
| (...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3959 Register temp2 = ToRegister(instr->temp2()); | 3959 Register temp2 = ToRegister(instr->temp2()); |
| 3960 | 3960 |
| 3961 MathExpGenerator::EmitMathExp(masm(), input, result, xmm0, temp1, temp2); | 3961 MathExpGenerator::EmitMathExp(masm(), input, result, xmm0, temp1, temp2); |
| 3962 } | 3962 } |
| 3963 | 3963 |
| 3964 | 3964 |
| 3965 void LCodeGen::DoMathTan(LUnaryMathOperation* instr) { | 3965 void LCodeGen::DoMathTan(LUnaryMathOperation* instr) { |
| 3966 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); | 3966 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); |
| 3967 TranscendentalCacheStub stub(TranscendentalCache::TAN, | 3967 TranscendentalCacheStub stub(TranscendentalCache::TAN, |
| 3968 TranscendentalCacheStub::UNTAGGED); | 3968 TranscendentalCacheStub::UNTAGGED); |
| 3969 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 3969 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| 3970 } | 3970 } |
| 3971 | 3971 |
| 3972 | 3972 |
| 3973 void LCodeGen::DoMathCos(LUnaryMathOperation* instr) { | 3973 void LCodeGen::DoMathCos(LUnaryMathOperation* instr) { |
| 3974 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); | 3974 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); |
| 3975 TranscendentalCacheStub stub(TranscendentalCache::COS, | 3975 TranscendentalCacheStub stub(TranscendentalCache::COS, |
| 3976 TranscendentalCacheStub::UNTAGGED); | 3976 TranscendentalCacheStub::UNTAGGED); |
| 3977 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 3977 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| 3978 } | 3978 } |
| 3979 | 3979 |
| 3980 | 3980 |
| 3981 void LCodeGen::DoMathSin(LUnaryMathOperation* instr) { | 3981 void LCodeGen::DoMathSin(LUnaryMathOperation* instr) { |
| 3982 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); | 3982 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); |
| 3983 TranscendentalCacheStub stub(TranscendentalCache::SIN, | 3983 TranscendentalCacheStub stub(TranscendentalCache::SIN, |
| 3984 TranscendentalCacheStub::UNTAGGED); | 3984 TranscendentalCacheStub::UNTAGGED); |
| 3985 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 3985 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| 3986 } | 3986 } |
| 3987 | 3987 |
| 3988 | 3988 |
| 3989 void LCodeGen::DoUnaryMathOperation(LUnaryMathOperation* instr) { | 3989 void LCodeGen::DoUnaryMathOperation(LUnaryMathOperation* instr) { |
| 3990 switch (instr->op()) { | 3990 switch (instr->op()) { |
| 3991 case kMathAbs: | 3991 case kMathAbs: |
| 3992 DoMathAbs(instr); | 3992 DoMathAbs(instr); |
| 3993 break; | 3993 break; |
| 3994 case kMathFloor: | 3994 case kMathFloor: |
| 3995 DoMathFloor(instr); | 3995 DoMathFloor(instr); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4066 } | 4066 } |
| 4067 | 4067 |
| 4068 | 4068 |
| 4069 void LCodeGen::DoCallFunction(LCallFunction* instr) { | 4069 void LCodeGen::DoCallFunction(LCallFunction* instr) { |
| 4070 ASSERT(ToRegister(instr->context()).is(esi)); | 4070 ASSERT(ToRegister(instr->context()).is(esi)); |
| 4071 ASSERT(ToRegister(instr->function()).is(edi)); | 4071 ASSERT(ToRegister(instr->function()).is(edi)); |
| 4072 ASSERT(ToRegister(instr->result()).is(eax)); | 4072 ASSERT(ToRegister(instr->result()).is(eax)); |
| 4073 | 4073 |
| 4074 int arity = instr->arity(); | 4074 int arity = instr->arity(); |
| 4075 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); | 4075 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); |
| 4076 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 4076 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| 4077 } | 4077 } |
| 4078 | 4078 |
| 4079 | 4079 |
| 4080 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { | 4080 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { |
| 4081 ASSERT(ToRegister(instr->context()).is(esi)); | 4081 ASSERT(ToRegister(instr->context()).is(esi)); |
| 4082 ASSERT(ToRegister(instr->result()).is(eax)); | 4082 ASSERT(ToRegister(instr->result()).is(eax)); |
| 4083 | 4083 |
| 4084 int arity = instr->arity(); | 4084 int arity = instr->arity(); |
| 4085 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT; | 4085 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT; |
| 4086 Handle<Code> ic = | 4086 Handle<Code> ic = |
| (...skipping 13 matching lines...) Expand all Loading... |
| 4100 } | 4100 } |
| 4101 | 4101 |
| 4102 | 4102 |
| 4103 void LCodeGen::DoCallNew(LCallNew* instr) { | 4103 void LCodeGen::DoCallNew(LCallNew* instr) { |
| 4104 ASSERT(ToRegister(instr->context()).is(esi)); | 4104 ASSERT(ToRegister(instr->context()).is(esi)); |
| 4105 ASSERT(ToRegister(instr->constructor()).is(edi)); | 4105 ASSERT(ToRegister(instr->constructor()).is(edi)); |
| 4106 ASSERT(ToRegister(instr->result()).is(eax)); | 4106 ASSERT(ToRegister(instr->result()).is(eax)); |
| 4107 | 4107 |
| 4108 CallConstructStub stub(NO_CALL_FUNCTION_FLAGS); | 4108 CallConstructStub stub(NO_CALL_FUNCTION_FLAGS); |
| 4109 __ Set(eax, Immediate(instr->arity())); | 4109 __ Set(eax, Immediate(instr->arity())); |
| 4110 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr); | 4110 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
| 4111 } | 4111 } |
| 4112 | 4112 |
| 4113 | 4113 |
| 4114 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { | 4114 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { |
| 4115 CallRuntime(instr->function(), instr->arity(), instr); | 4115 CallRuntime(instr->function(), instr->arity(), instr); |
| 4116 } | 4116 } |
| 4117 | 4117 |
| 4118 | 4118 |
| 4119 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { | 4119 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { |
| 4120 Register object = ToRegister(instr->object()); | 4120 Register object = ToRegister(instr->object()); |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4527 Register string = ToRegister(instr->string()); | 4527 Register string = ToRegister(instr->string()); |
| 4528 Register result = ToRegister(instr->result()); | 4528 Register result = ToRegister(instr->result()); |
| 4529 __ mov(result, FieldOperand(string, String::kLengthOffset)); | 4529 __ mov(result, FieldOperand(string, String::kLengthOffset)); |
| 4530 } | 4530 } |
| 4531 | 4531 |
| 4532 | 4532 |
| 4533 void LCodeGen::DoStringAdd(LStringAdd* instr) { | 4533 void LCodeGen::DoStringAdd(LStringAdd* instr) { |
| 4534 EmitPushTaggedOperand(instr->left()); | 4534 EmitPushTaggedOperand(instr->left()); |
| 4535 EmitPushTaggedOperand(instr->right()); | 4535 EmitPushTaggedOperand(instr->right()); |
| 4536 StringAddStub stub(NO_STRING_CHECK_IN_STUB); | 4536 StringAddStub stub(NO_STRING_CHECK_IN_STUB); |
| 4537 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 4537 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| 4538 } | 4538 } |
| 4539 | 4539 |
| 4540 | 4540 |
| 4541 void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) { | 4541 void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) { |
| 4542 if (CpuFeatures::IsSupported(SSE2)) { | 4542 if (CpuFeatures::IsSupported(SSE2)) { |
| 4543 CpuFeatures::Scope scope(SSE2); | 4543 CpuFeatures::Scope scope(SSE2); |
| 4544 LOperand* input = instr->value(); | 4544 LOperand* input = instr->value(); |
| 4545 ASSERT(input->IsRegister() || input->IsStackSlot()); | 4545 ASSERT(input->IsRegister() || input->IsStackSlot()); |
| 4546 LOperand* output = instr->result(); | 4546 LOperand* output = instr->result(); |
| 4547 ASSERT(output->IsDoubleRegister()); | 4547 ASSERT(output->IsDoubleRegister()); |
| (...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5537 // Pass an empty fixed array. | 5537 // Pass an empty fixed array. |
| 5538 __ push(Immediate(isolate()->factory()->empty_fixed_array())); | 5538 __ push(Immediate(isolate()->factory()->empty_fixed_array())); |
| 5539 | 5539 |
| 5540 // Pick the right runtime function or stub to call. | 5540 // Pick the right runtime function or stub to call. |
| 5541 int length = instr->hydrogen()->length(); | 5541 int length = instr->hydrogen()->length(); |
| 5542 if (instr->hydrogen()->IsCopyOnWrite()) { | 5542 if (instr->hydrogen()->IsCopyOnWrite()) { |
| 5543 ASSERT(instr->hydrogen()->depth() == 1); | 5543 ASSERT(instr->hydrogen()->depth() == 1); |
| 5544 FastCloneShallowArrayStub::Mode mode = | 5544 FastCloneShallowArrayStub::Mode mode = |
| 5545 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS; | 5545 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS; |
| 5546 FastCloneShallowArrayStub stub(mode, DONT_TRACK_ALLOCATION_SITE, length); | 5546 FastCloneShallowArrayStub stub(mode, DONT_TRACK_ALLOCATION_SITE, length); |
| 5547 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 5547 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| 5548 } else if (instr->hydrogen()->depth() > 1) { | 5548 } else if (instr->hydrogen()->depth() > 1) { |
| 5549 CallRuntime(Runtime::kCreateArrayLiteral, 3, instr); | 5549 CallRuntime(Runtime::kCreateArrayLiteral, 3, instr); |
| 5550 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { | 5550 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { |
| 5551 CallRuntime(Runtime::kCreateArrayLiteralShallow, 3, instr); | 5551 CallRuntime(Runtime::kCreateArrayLiteralShallow, 3, instr); |
| 5552 } else { | 5552 } else { |
| 5553 FastCloneShallowArrayStub::Mode mode = | 5553 FastCloneShallowArrayStub::Mode mode = |
| 5554 boilerplate_elements_kind == FAST_DOUBLE_ELEMENTS | 5554 boilerplate_elements_kind == FAST_DOUBLE_ELEMENTS |
| 5555 ? FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS | 5555 ? FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS |
| 5556 : FastCloneShallowArrayStub::CLONE_ELEMENTS; | 5556 : FastCloneShallowArrayStub::CLONE_ELEMENTS; |
| 5557 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); | 5557 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); |
| 5558 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 5558 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| 5559 } | 5559 } |
| 5560 } | 5560 } |
| 5561 | 5561 |
| 5562 | 5562 |
| 5563 void LCodeGen::EmitDeepCopy(Handle<JSObject> object, | 5563 void LCodeGen::EmitDeepCopy(Handle<JSObject> object, |
| 5564 Register result, | 5564 Register result, |
| 5565 Register source, | 5565 Register source, |
| 5566 int* offset, | 5566 int* offset, |
| 5567 AllocationSiteMode mode) { | 5567 AllocationSiteMode mode) { |
| 5568 ASSERT(!source.is(ecx)); | 5568 ASSERT(!source.is(ecx)); |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5760 __ push(Immediate(Smi::FromInt(instr->hydrogen()->literal_index()))); | 5760 __ push(Immediate(Smi::FromInt(instr->hydrogen()->literal_index()))); |
| 5761 __ push(Immediate(constant_properties)); | 5761 __ push(Immediate(constant_properties)); |
| 5762 __ push(Immediate(Smi::FromInt(flags))); | 5762 __ push(Immediate(Smi::FromInt(flags))); |
| 5763 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr); | 5763 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr); |
| 5764 } else { | 5764 } else { |
| 5765 __ LoadHeapObject(eax, literals); | 5765 __ LoadHeapObject(eax, literals); |
| 5766 __ mov(ebx, Immediate(Smi::FromInt(instr->hydrogen()->literal_index()))); | 5766 __ mov(ebx, Immediate(Smi::FromInt(instr->hydrogen()->literal_index()))); |
| 5767 __ mov(ecx, Immediate(constant_properties)); | 5767 __ mov(ecx, Immediate(constant_properties)); |
| 5768 __ mov(edx, Immediate(Smi::FromInt(flags))); | 5768 __ mov(edx, Immediate(Smi::FromInt(flags))); |
| 5769 FastCloneShallowObjectStub stub(properties_count); | 5769 FastCloneShallowObjectStub stub(properties_count); |
| 5770 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 5770 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| 5771 } | 5771 } |
| 5772 } | 5772 } |
| 5773 | 5773 |
| 5774 | 5774 |
| 5775 void LCodeGen::DoToFastProperties(LToFastProperties* instr) { | 5775 void LCodeGen::DoToFastProperties(LToFastProperties* instr) { |
| 5776 ASSERT(ToRegister(instr->value()).is(eax)); | 5776 ASSERT(ToRegister(instr->value()).is(eax)); |
| 5777 __ push(eax); | 5777 __ push(eax); |
| 5778 CallRuntime(Runtime::kToFastProperties, 1, instr); | 5778 CallRuntime(Runtime::kToFastProperties, 1, instr); |
| 5779 } | 5779 } |
| 5780 | 5780 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5833 | 5833 |
| 5834 void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) { | 5834 void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) { |
| 5835 ASSERT(ToRegister(instr->context()).is(esi)); | 5835 ASSERT(ToRegister(instr->context()).is(esi)); |
| 5836 // Use the fast case closure allocation code that allocates in new | 5836 // Use the fast case closure allocation code that allocates in new |
| 5837 // space for nested functions that don't need literals cloning. | 5837 // space for nested functions that don't need literals cloning. |
| 5838 Handle<SharedFunctionInfo> shared_info = instr->shared_info(); | 5838 Handle<SharedFunctionInfo> shared_info = instr->shared_info(); |
| 5839 bool pretenure = instr->hydrogen()->pretenure(); | 5839 bool pretenure = instr->hydrogen()->pretenure(); |
| 5840 if (!pretenure && shared_info->num_literals() == 0) { | 5840 if (!pretenure && shared_info->num_literals() == 0) { |
| 5841 FastNewClosureStub stub(shared_info->language_mode()); | 5841 FastNewClosureStub stub(shared_info->language_mode()); |
| 5842 __ push(Immediate(shared_info)); | 5842 __ push(Immediate(shared_info)); |
| 5843 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 5843 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| 5844 } else { | 5844 } else { |
| 5845 __ push(esi); | 5845 __ push(esi); |
| 5846 __ push(Immediate(shared_info)); | 5846 __ push(Immediate(shared_info)); |
| 5847 __ push(Immediate(pretenure | 5847 __ push(Immediate(pretenure |
| 5848 ? factory()->true_value() | 5848 ? factory()->true_value() |
| 5849 : factory()->false_value())); | 5849 : factory()->false_value())); |
| 5850 CallRuntime(Runtime::kNewClosure, 3, instr); | 5850 CallRuntime(Runtime::kNewClosure, 3, instr); |
| 5851 } | 5851 } |
| 5852 } | 5852 } |
| 5853 | 5853 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6054 // Perform stack overflow check. | 6054 // Perform stack overflow check. |
| 6055 Label done; | 6055 Label done; |
| 6056 ExternalReference stack_limit = | 6056 ExternalReference stack_limit = |
| 6057 ExternalReference::address_of_stack_limit(isolate()); | 6057 ExternalReference::address_of_stack_limit(isolate()); |
| 6058 __ cmp(esp, Operand::StaticVariable(stack_limit)); | 6058 __ cmp(esp, Operand::StaticVariable(stack_limit)); |
| 6059 __ j(above_equal, &done, Label::kNear); | 6059 __ j(above_equal, &done, Label::kNear); |
| 6060 | 6060 |
| 6061 ASSERT(instr->context()->IsRegister()); | 6061 ASSERT(instr->context()->IsRegister()); |
| 6062 ASSERT(ToRegister(instr->context()).is(esi)); | 6062 ASSERT(ToRegister(instr->context()).is(esi)); |
| 6063 StackCheckStub stub; | 6063 StackCheckStub stub; |
| 6064 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 6064 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| 6065 EnsureSpaceForLazyDeopt(); | 6065 EnsureSpaceForLazyDeopt(); |
| 6066 __ bind(&done); | 6066 __ bind(&done); |
| 6067 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); | 6067 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); |
| 6068 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); | 6068 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); |
| 6069 } else { | 6069 } else { |
| 6070 ASSERT(instr->hydrogen()->is_backwards_branch()); | 6070 ASSERT(instr->hydrogen()->is_backwards_branch()); |
| 6071 // Perform stack overflow check if this goto needs it before jumping. | 6071 // Perform stack overflow check if this goto needs it before jumping. |
| 6072 DeferredStackCheck* deferred_stack_check = | 6072 DeferredStackCheck* deferred_stack_check = |
| 6073 new(zone()) DeferredStackCheck(this, instr); | 6073 new(zone()) DeferredStackCheck(this, instr); |
| 6074 ExternalReference stack_limit = | 6074 ExternalReference stack_limit = |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6202 FixedArray::kHeaderSize - kPointerSize)); | 6202 FixedArray::kHeaderSize - kPointerSize)); |
| 6203 __ bind(&done); | 6203 __ bind(&done); |
| 6204 } | 6204 } |
| 6205 | 6205 |
| 6206 | 6206 |
| 6207 #undef __ | 6207 #undef __ |
| 6208 | 6208 |
| 6209 } } // namespace v8::internal | 6209 } } // namespace v8::internal |
| 6210 | 6210 |
| 6211 #endif // V8_TARGET_ARCH_IA32 | 6211 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |