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 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3296 | 3296 |
3297 // Check that the array has fast elements. | 3297 // Check that the array has fast elements. |
3298 __ test_b(FieldOperand(scratch, Map::kBitField2Offset), | 3298 __ test_b(FieldOperand(scratch, Map::kBitField2Offset), |
3299 1 << Map::kHasFastElements); | 3299 1 << Map::kHasFastElements); |
3300 __ j(zero, &bailout); | 3300 __ j(zero, &bailout); |
3301 | 3301 |
3302 // If the array has length zero, return the empty string. | 3302 // If the array has length zero, return the empty string. |
3303 __ mov(array_length, FieldOperand(array, JSArray::kLengthOffset)); | 3303 __ mov(array_length, FieldOperand(array, JSArray::kLengthOffset)); |
3304 __ SmiUntag(array_length); | 3304 __ SmiUntag(array_length); |
3305 __ j(not_zero, &non_trivial_array); | 3305 __ j(not_zero, &non_trivial_array); |
3306 __ mov(result_operand, FACTORY->empty_string()); | 3306 __ mov(result_operand, isolate()->factory()->empty_string()); |
3307 __ jmp(&done); | 3307 __ jmp(&done); |
3308 | 3308 |
3309 // Save the array length. | 3309 // Save the array length. |
3310 __ bind(&non_trivial_array); | 3310 __ bind(&non_trivial_array); |
3311 __ mov(array_length_operand, array_length); | 3311 __ mov(array_length_operand, array_length); |
3312 | 3312 |
3313 // Save the FixedArray containing array's elements. | 3313 // Save the FixedArray containing array's elements. |
3314 // End of array's live range. | 3314 // End of array's live range. |
3315 elements = array; | 3315 elements = array; |
3316 __ mov(elements, FieldOperand(array, JSArray::kElementsOffset)); | 3316 __ mov(elements, FieldOperand(array, JSArray::kElementsOffset)); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3507 FieldOperand(string, SeqAsciiString::kHeaderSize)); | 3507 FieldOperand(string, SeqAsciiString::kHeaderSize)); |
3508 __ CopyBytes(string, result_pos, string_length, scratch); | 3508 __ CopyBytes(string, result_pos, string_length, scratch); |
3509 __ add(Operand(index), Immediate(1)); | 3509 __ add(Operand(index), Immediate(1)); |
3510 | 3510 |
3511 __ cmp(index, array_length_operand); | 3511 __ cmp(index, array_length_operand); |
3512 __ j(less, &loop_3); // End while (index < length). | 3512 __ j(less, &loop_3); // End while (index < length). |
3513 __ jmp(&done); | 3513 __ jmp(&done); |
3514 | 3514 |
3515 | 3515 |
3516 __ bind(&bailout); | 3516 __ bind(&bailout); |
3517 __ mov(result_operand, FACTORY->undefined_value()); | 3517 __ mov(result_operand, isolate()->factory()->undefined_value()); |
3518 __ bind(&done); | 3518 __ bind(&done); |
3519 __ mov(eax, result_operand); | 3519 __ mov(eax, result_operand); |
3520 // Drop temp values from the stack, and restore context register. | 3520 // Drop temp values from the stack, and restore context register. |
3521 __ add(Operand(esp), Immediate(3 * kPointerSize)); | 3521 __ add(Operand(esp), Immediate(3 * kPointerSize)); |
3522 | 3522 |
3523 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 3523 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
3524 context()->Plug(eax); | 3524 context()->Plug(eax); |
3525 } | 3525 } |
3526 | 3526 |
3527 | 3527 |
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4286 // And return. | 4286 // And return. |
4287 __ ret(0); | 4287 __ ret(0); |
4288 } | 4288 } |
4289 | 4289 |
4290 | 4290 |
4291 #undef __ | 4291 #undef __ |
4292 | 4292 |
4293 } } // namespace v8::internal | 4293 } } // namespace v8::internal |
4294 | 4294 |
4295 #endif // V8_TARGET_ARCH_IA32 | 4295 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |