OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 3036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3047 static const bool kPassHandlesDirectly = true; | 3047 static const bool kPassHandlesDirectly = true; |
3048 #else | 3048 #else |
3049 static const bool kPassHandlesDirectly = false; | 3049 static const bool kPassHandlesDirectly = false; |
3050 #endif | 3050 #endif |
3051 | 3051 |
3052 | 3052 |
3053 void ApiGetterEntryStub::Generate(MacroAssembler* masm) { | 3053 void ApiGetterEntryStub::Generate(MacroAssembler* masm) { |
3054 Label empty_handle; | 3054 Label empty_handle; |
3055 Label prologue; | 3055 Label prologue; |
3056 Label promote_scheduled_exception; | 3056 Label promote_scheduled_exception; |
3057 __ EnterApiExitFrame(ExitFrame::MODE_NORMAL, kStackSpace, kArgc); | 3057 __ EnterApiExitFrame(kStackSpace, kArgc); |
3058 STATIC_ASSERT(kArgc == 4); | 3058 STATIC_ASSERT(kArgc == 4); |
3059 if (kPassHandlesDirectly) { | 3059 if (kPassHandlesDirectly) { |
3060 // When handles as passed directly we don't have to allocate extra | 3060 // When handles as passed directly we don't have to allocate extra |
3061 // space for and pass an out parameter. | 3061 // space for and pass an out parameter. |
3062 __ mov(Operand(esp, 0 * kPointerSize), ebx); // name. | 3062 __ mov(Operand(esp, 0 * kPointerSize), ebx); // name. |
3063 __ mov(Operand(esp, 1 * kPointerSize), eax); // arguments pointer. | 3063 __ mov(Operand(esp, 1 * kPointerSize), eax); // arguments pointer. |
3064 } else { | 3064 } else { |
3065 // The function expects three arguments to be passed but we allocate | 3065 // The function expects three arguments to be passed but we allocate |
3066 // four to get space for the output cell. The argument slots are filled | 3066 // four to get space for the output cell. The argument slots are filled |
3067 // as follows: | 3067 // as follows: |
(...skipping 25 matching lines...) Expand all Loading... |
3093 // The returned value is a pointer to the handle holding the result. | 3093 // The returned value is a pointer to the handle holding the result. |
3094 // Dereference this to get to the location. | 3094 // Dereference this to get to the location. |
3095 __ mov(eax, Operand(eax, 0)); | 3095 __ mov(eax, Operand(eax, 0)); |
3096 } | 3096 } |
3097 // Check if the result handle holds 0. | 3097 // Check if the result handle holds 0. |
3098 __ test(eax, Operand(eax)); | 3098 __ test(eax, Operand(eax)); |
3099 __ j(zero, &empty_handle, not_taken); | 3099 __ j(zero, &empty_handle, not_taken); |
3100 // It was non-zero. Dereference to get the result value. | 3100 // It was non-zero. Dereference to get the result value. |
3101 __ mov(eax, Operand(eax, 0)); | 3101 __ mov(eax, Operand(eax, 0)); |
3102 __ bind(&prologue); | 3102 __ bind(&prologue); |
3103 __ LeaveExitFrame(ExitFrame::MODE_NORMAL); | 3103 __ LeaveExitFrame(); |
3104 __ ret(0); | 3104 __ ret(0); |
3105 __ bind(&promote_scheduled_exception); | 3105 __ bind(&promote_scheduled_exception); |
3106 __ TailCallRuntime(Runtime::kPromoteScheduledException, 0, 1); | 3106 __ TailCallRuntime(Runtime::kPromoteScheduledException, 0, 1); |
3107 __ bind(&empty_handle); | 3107 __ bind(&empty_handle); |
3108 // It was zero; the result is undefined. | 3108 // It was zero; the result is undefined. |
3109 __ mov(eax, Factory::undefined_value()); | 3109 __ mov(eax, Factory::undefined_value()); |
3110 __ jmp(&prologue); | 3110 __ jmp(&prologue); |
3111 } | 3111 } |
3112 | 3112 |
3113 | 3113 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3170 | 3170 |
3171 // Check for failure result. | 3171 // Check for failure result. |
3172 Label failure_returned; | 3172 Label failure_returned; |
3173 STATIC_ASSERT(((kFailureTag + 1) & kFailureTagMask) == 0); | 3173 STATIC_ASSERT(((kFailureTag + 1) & kFailureTagMask) == 0); |
3174 __ lea(ecx, Operand(eax, 1)); | 3174 __ lea(ecx, Operand(eax, 1)); |
3175 // Lower 2 bits of ecx are 0 iff eax has failure tag. | 3175 // Lower 2 bits of ecx are 0 iff eax has failure tag. |
3176 __ test(ecx, Immediate(kFailureTagMask)); | 3176 __ test(ecx, Immediate(kFailureTagMask)); |
3177 __ j(zero, &failure_returned, not_taken); | 3177 __ j(zero, &failure_returned, not_taken); |
3178 | 3178 |
3179 // Exit the JavaScript to C++ exit frame. | 3179 // Exit the JavaScript to C++ exit frame. |
3180 __ LeaveExitFrame(mode_); | 3180 __ LeaveExitFrame(); |
3181 __ ret(0); | 3181 __ ret(0); |
3182 | 3182 |
3183 // Handling of failure. | 3183 // Handling of failure. |
3184 __ bind(&failure_returned); | 3184 __ bind(&failure_returned); |
3185 | 3185 |
3186 Label retry; | 3186 Label retry; |
3187 // If the returned exception is RETRY_AFTER_GC continue at retry label | 3187 // If the returned exception is RETRY_AFTER_GC continue at retry label |
3188 STATIC_ASSERT(Failure::RETRY_AFTER_GC == 0); | 3188 STATIC_ASSERT(Failure::RETRY_AFTER_GC == 0); |
3189 __ test(eax, Immediate(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); | 3189 __ test(eax, Immediate(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); |
3190 __ j(zero, &retry, taken); | 3190 __ j(zero, &retry, taken); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3270 // ebp: frame pointer (restored after C call) | 3270 // ebp: frame pointer (restored after C call) |
3271 // esp: stack pointer (restored after C call) | 3271 // esp: stack pointer (restored after C call) |
3272 // esi: current context (C callee-saved) | 3272 // esi: current context (C callee-saved) |
3273 // edi: JS function of the caller (C callee-saved) | 3273 // edi: JS function of the caller (C callee-saved) |
3274 | 3274 |
3275 // NOTE: Invocations of builtins may return failure objects instead | 3275 // NOTE: Invocations of builtins may return failure objects instead |
3276 // of a proper result. The builtin entry handles this by performing | 3276 // of a proper result. The builtin entry handles this by performing |
3277 // a garbage collection and retrying the builtin (twice). | 3277 // a garbage collection and retrying the builtin (twice). |
3278 | 3278 |
3279 // Enter the exit frame that transitions from JavaScript to C++. | 3279 // Enter the exit frame that transitions from JavaScript to C++. |
3280 __ EnterExitFrame(mode_); | 3280 __ EnterExitFrame(); |
3281 | 3281 |
3282 // eax: result parameter for PerformGC, if any (setup below) | 3282 // eax: result parameter for PerformGC, if any (setup below) |
3283 // ebx: pointer to builtin function (C callee-saved) | 3283 // ebx: pointer to builtin function (C callee-saved) |
3284 // ebp: frame pointer (restored after C call) | 3284 // ebp: frame pointer (restored after C call) |
3285 // esp: stack pointer (restored after C call) | 3285 // esp: stack pointer (restored after C call) |
3286 // edi: number of arguments including receiver (C callee-saved) | 3286 // edi: number of arguments including receiver (C callee-saved) |
3287 // esi: argv pointer (C callee-saved) | 3287 // esi: argv pointer (C callee-saved) |
3288 | 3288 |
3289 Label throw_normal_exception; | 3289 Label throw_normal_exception; |
3290 Label throw_termination_exception; | 3290 Label throw_termination_exception; |
(...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4530 // tagged as a small integer. | 4530 // tagged as a small integer. |
4531 __ bind(&runtime); | 4531 __ bind(&runtime); |
4532 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); | 4532 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); |
4533 } | 4533 } |
4534 | 4534 |
4535 #undef __ | 4535 #undef __ |
4536 | 4536 |
4537 } } // namespace v8::internal | 4537 } } // namespace v8::internal |
4538 | 4538 |
4539 #endif // V8_TARGET_ARCH_IA32 | 4539 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |