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 2279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2290 | 2290 |
2291 void MacroAssembler::PrepareCallApiFunction(int argc) { | 2291 void MacroAssembler::PrepareCallApiFunction(int argc) { |
2292 EnterApiExitFrame(argc); | 2292 EnterApiExitFrame(argc); |
2293 if (emit_debug_code()) { | 2293 if (emit_debug_code()) { |
2294 mov(esi, Immediate(BitCast<int32_t>(kZapValue))); | 2294 mov(esi, Immediate(BitCast<int32_t>(kZapValue))); |
2295 } | 2295 } |
2296 } | 2296 } |
2297 | 2297 |
2298 | 2298 |
2299 void MacroAssembler::CallApiFunctionAndReturn( | 2299 void MacroAssembler::CallApiFunctionAndReturn( |
2300 Address function_address, | 2300 Register function_address, |
2301 Address thunk_address, | 2301 Address thunk_address, |
2302 Operand thunk_last_arg, | 2302 Operand thunk_last_arg, |
2303 int stack_space, | 2303 int stack_space, |
2304 Operand return_value_operand, | 2304 Operand return_value_operand, |
2305 Operand* context_restore_operand) { | 2305 Operand* context_restore_operand) { |
2306 ExternalReference next_address = | 2306 ExternalReference next_address = |
2307 ExternalReference::handle_scope_next_address(isolate()); | 2307 ExternalReference::handle_scope_next_address(isolate()); |
2308 ExternalReference limit_address = | 2308 ExternalReference limit_address = |
2309 ExternalReference::handle_scope_limit_address(isolate()); | 2309 ExternalReference::handle_scope_limit_address(isolate()); |
2310 ExternalReference level_address = | 2310 ExternalReference level_address = |
2311 ExternalReference::handle_scope_level_address(isolate()); | 2311 ExternalReference::handle_scope_level_address(isolate()); |
2312 | 2312 |
| 2313 ASSERT(edx.is(function_address)); |
2313 // Allocate HandleScope in callee-save registers. | 2314 // Allocate HandleScope in callee-save registers. |
2314 mov(ebx, Operand::StaticVariable(next_address)); | 2315 mov(ebx, Operand::StaticVariable(next_address)); |
2315 mov(edi, Operand::StaticVariable(limit_address)); | 2316 mov(edi, Operand::StaticVariable(limit_address)); |
2316 add(Operand::StaticVariable(level_address), Immediate(1)); | 2317 add(Operand::StaticVariable(level_address), Immediate(1)); |
2317 | 2318 |
2318 if (FLAG_log_timer_events) { | 2319 if (FLAG_log_timer_events) { |
2319 FrameScope frame(this, StackFrame::MANUAL); | 2320 FrameScope frame(this, StackFrame::MANUAL); |
2320 PushSafepointRegisters(); | 2321 PushSafepointRegisters(); |
2321 PrepareCallCFunction(1, eax); | 2322 PrepareCallCFunction(1, eax); |
2322 mov(Operand(esp, 0), | 2323 mov(Operand(esp, 0), |
2323 Immediate(ExternalReference::isolate_address(isolate()))); | 2324 Immediate(ExternalReference::isolate_address(isolate()))); |
2324 CallCFunction(ExternalReference::log_enter_external_function(isolate()), 1); | 2325 CallCFunction(ExternalReference::log_enter_external_function(isolate()), 1); |
2325 PopSafepointRegisters(); | 2326 PopSafepointRegisters(); |
2326 } | 2327 } |
2327 | 2328 |
2328 | 2329 |
2329 Label profiler_disabled; | 2330 Label profiler_disabled; |
2330 Label end_profiler_check; | 2331 Label end_profiler_check; |
2331 bool* is_profiling_flag = | 2332 bool* is_profiling_flag = |
2332 isolate()->cpu_profiler()->is_profiling_address(); | 2333 isolate()->cpu_profiler()->is_profiling_address(); |
2333 STATIC_ASSERT(sizeof(*is_profiling_flag) == 1); | 2334 STATIC_ASSERT(sizeof(*is_profiling_flag) == 1); |
2334 mov(eax, Immediate(reinterpret_cast<Address>(is_profiling_flag))); | 2335 mov(eax, Immediate(reinterpret_cast<Address>(is_profiling_flag))); |
2335 cmpb(Operand(eax, 0), 0); | 2336 cmpb(Operand(eax, 0), 0); |
2336 j(zero, &profiler_disabled); | 2337 j(zero, &profiler_disabled); |
2337 | 2338 |
2338 // Additional parameter is the address of the actual getter function. | 2339 // Additional parameter is the address of the actual getter function. |
2339 mov(thunk_last_arg, Immediate(function_address)); | 2340 mov(thunk_last_arg, function_address); |
2340 // Call the api function. | 2341 // Call the api function. |
2341 call(thunk_address, RelocInfo::RUNTIME_ENTRY); | 2342 call(thunk_address, RelocInfo::RUNTIME_ENTRY); |
2342 jmp(&end_profiler_check); | 2343 jmp(&end_profiler_check); |
2343 | 2344 |
2344 bind(&profiler_disabled); | 2345 bind(&profiler_disabled); |
2345 // Call the api function. | 2346 // Call the api function. |
2346 call(function_address, RelocInfo::RUNTIME_ENTRY); | 2347 call(function_address); |
2347 bind(&end_profiler_check); | 2348 bind(&end_profiler_check); |
2348 | 2349 |
2349 if (FLAG_log_timer_events) { | 2350 if (FLAG_log_timer_events) { |
2350 FrameScope frame(this, StackFrame::MANUAL); | 2351 FrameScope frame(this, StackFrame::MANUAL); |
2351 PushSafepointRegisters(); | 2352 PushSafepointRegisters(); |
2352 PrepareCallCFunction(1, eax); | 2353 PrepareCallCFunction(1, eax); |
2353 mov(Operand(esp, 0), | 2354 mov(Operand(esp, 0), |
2354 Immediate(ExternalReference::isolate_address(isolate()))); | 2355 Immediate(ExternalReference::isolate_address(isolate()))); |
2355 CallCFunction(ExternalReference::log_leave_external_function(isolate()), 1); | 2356 CallCFunction(ExternalReference::log_leave_external_function(isolate()), 1); |
2356 PopSafepointRegisters(); | 2357 PopSafepointRegisters(); |
(...skipping 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3643 cmp(scratch1, Immediate(DICTIONARY_ELEMENTS)); | 3644 cmp(scratch1, Immediate(DICTIONARY_ELEMENTS)); |
3644 j(equal, found); | 3645 j(equal, found); |
3645 mov(current, FieldOperand(current, Map::kPrototypeOffset)); | 3646 mov(current, FieldOperand(current, Map::kPrototypeOffset)); |
3646 cmp(current, Immediate(factory->null_value())); | 3647 cmp(current, Immediate(factory->null_value())); |
3647 j(not_equal, &loop_again); | 3648 j(not_equal, &loop_again); |
3648 } | 3649 } |
3649 | 3650 |
3650 } } // namespace v8::internal | 3651 } } // namespace v8::internal |
3651 | 3652 |
3652 #endif // V8_TARGET_ARCH_IA32 | 3653 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |