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 12257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12268 // using the location_ field directly. If false, it is passed and | 12268 // using the location_ field directly. If false, it is passed and |
12269 // returned as a pointer to a handle. | 12269 // returned as a pointer to a handle. |
12270 #ifdef USING_BSD_ABI | 12270 #ifdef USING_BSD_ABI |
12271 static const bool kPassHandlesDirectly = true; | 12271 static const bool kPassHandlesDirectly = true; |
12272 #else | 12272 #else |
12273 static const bool kPassHandlesDirectly = false; | 12273 static const bool kPassHandlesDirectly = false; |
12274 #endif | 12274 #endif |
12275 | 12275 |
12276 | 12276 |
12277 void ApiGetterEntryStub::Generate(MacroAssembler* masm) { | 12277 void ApiGetterEntryStub::Generate(MacroAssembler* masm) { |
12278 Label get_result; | 12278 Label empty_handle; |
12279 Label prologue; | 12279 Label prologue; |
12280 Label promote_scheduled_exception; | 12280 Label promote_scheduled_exception; |
12281 __ EnterApiExitFrame(ExitFrame::MODE_NORMAL, kStackSpace, kArgc); | 12281 __ EnterApiExitFrame(ExitFrame::MODE_NORMAL, kStackSpace, kArgc); |
12282 STATIC_ASSERT(kArgc == 4); | 12282 STATIC_ASSERT(kArgc == 4); |
12283 if (kPassHandlesDirectly) { | 12283 if (kPassHandlesDirectly) { |
12284 // When handles as passed directly we don't have to allocate extra | 12284 // When handles as passed directly we don't have to allocate extra |
12285 // space for and pass an out parameter. | 12285 // space for and pass an out parameter. |
12286 __ mov(Operand(esp, 0 * kPointerSize), ebx); // name. | 12286 __ mov(Operand(esp, 0 * kPointerSize), ebx); // name. |
12287 __ mov(Operand(esp, 1 * kPointerSize), eax); // arguments pointer. | 12287 __ mov(Operand(esp, 1 * kPointerSize), eax); // arguments pointer. |
12288 } else { | 12288 } else { |
(...skipping 22 matching lines...) Expand all Loading... |
12311 ExternalReference scheduled_exception_address = | 12311 ExternalReference scheduled_exception_address = |
12312 ExternalReference::scheduled_exception_address(); | 12312 ExternalReference::scheduled_exception_address(); |
12313 __ cmp(Operand::StaticVariable(scheduled_exception_address), | 12313 __ cmp(Operand::StaticVariable(scheduled_exception_address), |
12314 Immediate(Factory::the_hole_value())); | 12314 Immediate(Factory::the_hole_value())); |
12315 __ j(not_equal, &promote_scheduled_exception, not_taken); | 12315 __ j(not_equal, &promote_scheduled_exception, not_taken); |
12316 if (!kPassHandlesDirectly) { | 12316 if (!kPassHandlesDirectly) { |
12317 // The returned value is a pointer to the handle holding the result. | 12317 // The returned value is a pointer to the handle holding the result. |
12318 // Dereference this to get to the location. | 12318 // Dereference this to get to the location. |
12319 __ mov(eax, Operand(eax, 0)); | 12319 __ mov(eax, Operand(eax, 0)); |
12320 } | 12320 } |
12321 // Check if the result handle holds 0 | 12321 // Check if the result handle holds 0. |
12322 __ test(eax, Operand(eax)); | 12322 __ test(eax, Operand(eax)); |
12323 __ j(not_zero, &get_result, taken); | 12323 __ j(zero, &empty_handle, not_taken); |
12324 // It was zero; the result is undefined. | |
12325 __ mov(eax, Factory::undefined_value()); | |
12326 __ jmp(&prologue); | |
12327 // It was non-zero. Dereference to get the result value. | 12324 // It was non-zero. Dereference to get the result value. |
12328 __ bind(&get_result); | |
12329 __ mov(eax, Operand(eax, 0)); | 12325 __ mov(eax, Operand(eax, 0)); |
12330 __ bind(&prologue); | 12326 __ bind(&prologue); |
12331 __ LeaveExitFrame(ExitFrame::MODE_NORMAL); | 12327 __ LeaveExitFrame(ExitFrame::MODE_NORMAL); |
12332 __ ret(0); | 12328 __ ret(0); |
12333 __ bind(&promote_scheduled_exception); | 12329 __ bind(&promote_scheduled_exception); |
12334 __ TailCallRuntime(Runtime::kPromoteScheduledException, 0, 1); | 12330 __ TailCallRuntime(Runtime::kPromoteScheduledException, 0, 1); |
| 12331 __ bind(&empty_handle); |
| 12332 // It was zero; the result is undefined. |
| 12333 __ mov(eax, Factory::undefined_value()); |
| 12334 __ jmp(&prologue); |
12335 } | 12335 } |
12336 | 12336 |
12337 | 12337 |
12338 void CEntryStub::GenerateCore(MacroAssembler* masm, | 12338 void CEntryStub::GenerateCore(MacroAssembler* masm, |
12339 Label* throw_normal_exception, | 12339 Label* throw_normal_exception, |
12340 Label* throw_termination_exception, | 12340 Label* throw_termination_exception, |
12341 Label* throw_out_of_memory_exception, | 12341 Label* throw_out_of_memory_exception, |
12342 bool do_gc, | 12342 bool do_gc, |
12343 bool always_allocate_scope, | 12343 bool always_allocate_scope, |
12344 int /* alignment_skew */) { | 12344 int /* alignment_skew */) { |
(...skipping 1614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13959 masm.GetCode(&desc); | 13959 masm.GetCode(&desc); |
13960 // Call the function from C++. | 13960 // Call the function from C++. |
13961 return FUNCTION_CAST<MemCopyFunction>(buffer); | 13961 return FUNCTION_CAST<MemCopyFunction>(buffer); |
13962 } | 13962 } |
13963 | 13963 |
13964 #undef __ | 13964 #undef __ |
13965 | 13965 |
13966 } } // namespace v8::internal | 13966 } } // namespace v8::internal |
13967 | 13967 |
13968 #endif // V8_TARGET_ARCH_IA32 | 13968 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |