OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 2079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2090 context()->DropAndPlug(1, eax); | 2090 context()->DropAndPlug(1, eax); |
2091 } | 2091 } |
2092 | 2092 |
2093 | 2093 |
2094 void FullCodeGenerator::EmitResolvePossiblyDirectEval(ResolveEvalFlag flag, | 2094 void FullCodeGenerator::EmitResolvePossiblyDirectEval(ResolveEvalFlag flag, |
2095 int arg_count) { | 2095 int arg_count) { |
2096 // Push copy of the first argument or undefined if it doesn't exist. | 2096 // Push copy of the first argument or undefined if it doesn't exist. |
2097 if (arg_count > 0) { | 2097 if (arg_count > 0) { |
2098 __ push(Operand(esp, arg_count * kPointerSize)); | 2098 __ push(Operand(esp, arg_count * kPointerSize)); |
2099 } else { | 2099 } else { |
2100 __ push(Immediate(FACTORY->undefined_value())); | 2100 __ push(Immediate(isolate()->factory()->undefined_value())); |
2101 } | 2101 } |
2102 | 2102 |
2103 // Push the receiver of the enclosing function. | 2103 // Push the receiver of the enclosing function. |
2104 __ push(Operand(ebp, (2 + scope()->num_parameters()) * kPointerSize)); | 2104 __ push(Operand(ebp, (2 + scope()->num_parameters()) * kPointerSize)); |
2105 | 2105 |
2106 // Push the strict mode flag. | 2106 // Push the strict mode flag. |
2107 __ push(Immediate(Smi::FromInt(strict_mode_flag()))); | 2107 __ push(Immediate(Smi::FromInt(strict_mode_flag()))); |
2108 | 2108 |
2109 __ CallRuntime(flag == SKIP_CONTEXT_LOOKUP | 2109 __ CallRuntime(flag == SKIP_CONTEXT_LOOKUP |
2110 ? Runtime::kResolvePossiblyDirectEvalNoLookup | 2110 ? Runtime::kResolvePossiblyDirectEvalNoLookup |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2793 context()->Plug(eax); | 2793 context()->Plug(eax); |
2794 } | 2794 } |
2795 | 2795 |
2796 | 2796 |
2797 void FullCodeGenerator::EmitMathPow(ZoneList<Expression*>* args) { | 2797 void FullCodeGenerator::EmitMathPow(ZoneList<Expression*>* args) { |
2798 // Load the arguments on the stack and call the runtime function. | 2798 // Load the arguments on the stack and call the runtime function. |
2799 ASSERT(args->length() == 2); | 2799 ASSERT(args->length() == 2); |
2800 VisitForStackValue(args->at(0)); | 2800 VisitForStackValue(args->at(0)); |
2801 VisitForStackValue(args->at(1)); | 2801 VisitForStackValue(args->at(1)); |
2802 | 2802 |
2803 if (masm()->isolate()->cpu_features()->IsSupported(SSE2)) { | 2803 if (isolate()->cpu_features()->IsSupported(SSE2)) { |
2804 MathPowStub stub; | 2804 MathPowStub stub; |
2805 __ CallStub(&stub); | 2805 __ CallStub(&stub); |
2806 } else { | 2806 } else { |
2807 __ CallRuntime(Runtime::kMath_pow, 2); | 2807 __ CallRuntime(Runtime::kMath_pow, 2); |
2808 } | 2808 } |
2809 context()->Plug(eax); | 2809 context()->Plug(eax); |
2810 } | 2810 } |
2811 | 2811 |
2812 | 2812 |
2813 void FullCodeGenerator::EmitSetValueOf(ZoneList<Expression*>* args) { | 2813 void FullCodeGenerator::EmitSetValueOf(ZoneList<Expression*>* args) { |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3300 | 3300 |
3301 // Check that the array has fast elements. | 3301 // Check that the array has fast elements. |
3302 __ test_b(FieldOperand(scratch, Map::kBitField2Offset), | 3302 __ test_b(FieldOperand(scratch, Map::kBitField2Offset), |
3303 1 << Map::kHasFastElements); | 3303 1 << Map::kHasFastElements); |
3304 __ j(zero, &bailout); | 3304 __ j(zero, &bailout); |
3305 | 3305 |
3306 // If the array has length zero, return the empty string. | 3306 // If the array has length zero, return the empty string. |
3307 __ mov(array_length, FieldOperand(array, JSArray::kLengthOffset)); | 3307 __ mov(array_length, FieldOperand(array, JSArray::kLengthOffset)); |
3308 __ SmiUntag(array_length); | 3308 __ SmiUntag(array_length); |
3309 __ j(not_zero, &non_trivial_array); | 3309 __ j(not_zero, &non_trivial_array); |
3310 __ mov(result_operand, FACTORY->empty_string()); | 3310 __ mov(result_operand, isolate()->factory()->empty_string()); |
3311 __ jmp(&done); | 3311 __ jmp(&done); |
3312 | 3312 |
3313 // Save the array length. | 3313 // Save the array length. |
3314 __ bind(&non_trivial_array); | 3314 __ bind(&non_trivial_array); |
3315 __ mov(array_length_operand, array_length); | 3315 __ mov(array_length_operand, array_length); |
3316 | 3316 |
3317 // Save the FixedArray containing array's elements. | 3317 // Save the FixedArray containing array's elements. |
3318 // End of array's live range. | 3318 // End of array's live range. |
3319 elements = array; | 3319 elements = array; |
3320 __ mov(elements, FieldOperand(array, JSArray::kElementsOffset)); | 3320 __ mov(elements, FieldOperand(array, JSArray::kElementsOffset)); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3511 FieldOperand(string, SeqAsciiString::kHeaderSize)); | 3511 FieldOperand(string, SeqAsciiString::kHeaderSize)); |
3512 __ CopyBytes(string, result_pos, string_length, scratch); | 3512 __ CopyBytes(string, result_pos, string_length, scratch); |
3513 __ add(Operand(index), Immediate(1)); | 3513 __ add(Operand(index), Immediate(1)); |
3514 | 3514 |
3515 __ cmp(index, array_length_operand); | 3515 __ cmp(index, array_length_operand); |
3516 __ j(less, &loop_3); // End while (index < length). | 3516 __ j(less, &loop_3); // End while (index < length). |
3517 __ jmp(&done); | 3517 __ jmp(&done); |
3518 | 3518 |
3519 | 3519 |
3520 __ bind(&bailout); | 3520 __ bind(&bailout); |
3521 __ mov(result_operand, FACTORY->undefined_value()); | 3521 __ mov(result_operand, isolate()->factory()->undefined_value()); |
3522 __ bind(&done); | 3522 __ bind(&done); |
3523 __ mov(eax, result_operand); | 3523 __ mov(eax, result_operand); |
3524 // Drop temp values from the stack, and restore context register. | 3524 // Drop temp values from the stack, and restore context register. |
3525 __ add(Operand(esp), Immediate(3 * kPointerSize)); | 3525 __ add(Operand(esp), Immediate(3 * kPointerSize)); |
3526 | 3526 |
3527 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 3527 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
3528 context()->Plug(eax); | 3528 context()->Plug(eax); |
3529 } | 3529 } |
3530 | 3530 |
3531 | 3531 |
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4217 __ nop(); // Signals no inlined code. | 4217 __ nop(); // Signals no inlined code. |
4218 break; | 4218 break; |
4219 default: | 4219 default: |
4220 // Do nothing. | 4220 // Do nothing. |
4221 break; | 4221 break; |
4222 } | 4222 } |
4223 } | 4223 } |
4224 | 4224 |
4225 | 4225 |
4226 void FullCodeGenerator::EmitCallIC(Handle<Code> ic, JumpPatchSite* patch_site) { | 4226 void FullCodeGenerator::EmitCallIC(Handle<Code> ic, JumpPatchSite* patch_site) { |
4227 Counters* counters = masm()->isolate()->counters(); | 4227 Counters* counters = isolate()->counters(); |
4228 switch (ic->kind()) { | 4228 switch (ic->kind()) { |
4229 case Code::LOAD_IC: | 4229 case Code::LOAD_IC: |
4230 __ IncrementCounter(counters->named_load_full(), 1); | 4230 __ IncrementCounter(counters->named_load_full(), 1); |
4231 break; | 4231 break; |
4232 case Code::KEYED_LOAD_IC: | 4232 case Code::KEYED_LOAD_IC: |
4233 __ IncrementCounter(counters->keyed_load_full(), 1); | 4233 __ IncrementCounter(counters->keyed_load_full(), 1); |
4234 break; | 4234 break; |
4235 case Code::STORE_IC: | 4235 case Code::STORE_IC: |
4236 __ IncrementCounter(counters->named_store_full(), 1); | 4236 __ IncrementCounter(counters->named_store_full(), 1); |
4237 break; | 4237 break; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4290 // And return. | 4290 // And return. |
4291 __ ret(0); | 4291 __ ret(0); |
4292 } | 4292 } |
4293 | 4293 |
4294 | 4294 |
4295 #undef __ | 4295 #undef __ |
4296 | 4296 |
4297 } } // namespace v8::internal | 4297 } } // namespace v8::internal |
4298 | 4298 |
4299 #endif // V8_TARGET_ARCH_IA32 | 4299 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |