Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: src/arm/macro-assembler-arm.cc

Issue 140613004: stub fast api calls (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: comments Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/arm/stub-cache-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2280 matching lines...) Expand 10 before | Expand all | Expand 10 after
2291 Jump(stub->GetCode(isolate()), RelocInfo::CODE_TARGET, cond); 2291 Jump(stub->GetCode(isolate()), RelocInfo::CODE_TARGET, cond);
2292 } 2292 }
2293 2293
2294 2294
2295 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { 2295 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) {
2296 return ref0.address() - ref1.address(); 2296 return ref0.address() - ref1.address();
2297 } 2297 }
2298 2298
2299 2299
2300 void MacroAssembler::CallApiFunctionAndReturn( 2300 void MacroAssembler::CallApiFunctionAndReturn(
2301 ExternalReference function, 2301 Register function_address,
2302 Address function_address,
2303 ExternalReference thunk_ref, 2302 ExternalReference thunk_ref,
2304 Register thunk_last_arg, 2303 Register thunk_last_arg,
2305 int stack_space, 2304 int stack_space,
2306 MemOperand return_value_operand, 2305 MemOperand return_value_operand,
2307 MemOperand* context_restore_operand) { 2306 MemOperand* context_restore_operand) {
2308 ExternalReference next_address = 2307 ExternalReference next_address =
2309 ExternalReference::handle_scope_next_address(isolate()); 2308 ExternalReference::handle_scope_next_address(isolate());
2310 const int kNextOffset = 0; 2309 const int kNextOffset = 0;
2311 const int kLimitOffset = AddressOffset( 2310 const int kLimitOffset = AddressOffset(
2312 ExternalReference::handle_scope_limit_address(isolate()), 2311 ExternalReference::handle_scope_limit_address(isolate()),
2313 next_address); 2312 next_address);
2314 const int kLevelOffset = AddressOffset( 2313 const int kLevelOffset = AddressOffset(
2315 ExternalReference::handle_scope_level_address(isolate()), 2314 ExternalReference::handle_scope_level_address(isolate()),
2316 next_address); 2315 next_address);
2317 2316
2318 ASSERT(!thunk_last_arg.is(r3)); 2317 ASSERT(function_address.is(r3));
2318 ASSERT(thunk_last_arg.is(r1) || thunk_last_arg.is(r2));
2319
2320 Label profiler_disabled;
2321 Label end_profiler_check;
2322 bool* is_profiling_flag =
2323 isolate()->cpu_profiler()->is_profiling_address();
2324 STATIC_ASSERT(sizeof(*is_profiling_flag) == 1);
2325 mov(r9, Operand(reinterpret_cast<int32_t>(is_profiling_flag)));
2326 ldrb(r9, MemOperand(r9, 0));
2327 cmp(r9, Operand(0));
2328 b(eq, &profiler_disabled);
2329
2330 // Additional parameter is the address of the actual callback.
2331 mov(r3, Operand(thunk_ref));
2332 jmp(&end_profiler_check);
2333
2334 bind(&profiler_disabled);
2335 Move(r3, function_address);
2336 bind(&end_profiler_check);
2319 2337
2320 // Allocate HandleScope in callee-save registers. 2338 // Allocate HandleScope in callee-save registers.
2321 mov(r9, Operand(next_address)); 2339 mov(r9, Operand(next_address));
2322 ldr(r4, MemOperand(r9, kNextOffset)); 2340 ldr(r4, MemOperand(r9, kNextOffset));
2323 ldr(r5, MemOperand(r9, kLimitOffset)); 2341 ldr(r5, MemOperand(r9, kLimitOffset));
2324 ldr(r6, MemOperand(r9, kLevelOffset)); 2342 ldr(r6, MemOperand(r9, kLevelOffset));
2325 add(r6, r6, Operand(1)); 2343 add(r6, r6, Operand(1));
2326 str(r6, MemOperand(r9, kLevelOffset)); 2344 str(r6, MemOperand(r9, kLevelOffset));
2327 2345
2328 if (FLAG_log_timer_events) { 2346 if (FLAG_log_timer_events) {
2329 FrameScope frame(this, StackFrame::MANUAL); 2347 FrameScope frame(this, StackFrame::MANUAL);
2330 PushSafepointRegisters(); 2348 PushSafepointRegisters();
2331 PrepareCallCFunction(1, r0); 2349 PrepareCallCFunction(1, r0);
2332 mov(r0, Operand(ExternalReference::isolate_address(isolate()))); 2350 mov(r0, Operand(ExternalReference::isolate_address(isolate())));
2333 CallCFunction(ExternalReference::log_enter_external_function(isolate()), 1); 2351 CallCFunction(ExternalReference::log_enter_external_function(isolate()), 1);
2334 PopSafepointRegisters(); 2352 PopSafepointRegisters();
2335 } 2353 }
2336 2354
2337 Label profiler_disabled;
2338 Label end_profiler_check;
2339 bool* is_profiling_flag =
2340 isolate()->cpu_profiler()->is_profiling_address();
2341 STATIC_ASSERT(sizeof(*is_profiling_flag) == 1);
2342 mov(r3, Operand(reinterpret_cast<int32_t>(is_profiling_flag)));
2343 ldrb(r3, MemOperand(r3, 0));
2344 cmp(r3, Operand(0));
2345 b(eq, &profiler_disabled);
2346
2347 // Additional parameter is the address of the actual callback.
2348 mov(thunk_last_arg, Operand(reinterpret_cast<int32_t>(function_address)));
2349 mov(r3, Operand(thunk_ref));
2350 jmp(&end_profiler_check);
2351
2352 bind(&profiler_disabled);
2353 mov(r3, Operand(function));
2354 bind(&end_profiler_check);
2355
2356 // Native call returns to the DirectCEntry stub which redirects to the 2355 // Native call returns to the DirectCEntry stub which redirects to the
2357 // return address pushed on stack (could have moved after GC). 2356 // return address pushed on stack (could have moved after GC).
2358 // DirectCEntry stub itself is generated early and never moves. 2357 // DirectCEntry stub itself is generated early and never moves.
2359 DirectCEntryStub stub; 2358 DirectCEntryStub stub;
2360 stub.GenerateCall(this, r3); 2359 stub.GenerateCall(this, r3);
2361 2360
2362 if (FLAG_log_timer_events) { 2361 if (FLAG_log_timer_events) {
2363 FrameScope frame(this, StackFrame::MANUAL); 2362 FrameScope frame(this, StackFrame::MANUAL);
2364 PushSafepointRegisters(); 2363 PushSafepointRegisters();
2365 PrepareCallCFunction(1, r0); 2364 PrepareCallCFunction(1, r0);
(...skipping 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after
4077 void CodePatcher::EmitCondition(Condition cond) { 4076 void CodePatcher::EmitCondition(Condition cond) {
4078 Instr instr = Assembler::instr_at(masm_.pc_); 4077 Instr instr = Assembler::instr_at(masm_.pc_);
4079 instr = (instr & ~kCondMask) | cond; 4078 instr = (instr & ~kCondMask) | cond;
4080 masm_.emit(instr); 4079 masm_.emit(instr);
4081 } 4080 }
4082 4081
4083 4082
4084 } } // namespace v8::internal 4083 } } // namespace v8::internal
4085 4084
4086 #endif // V8_TARGET_ARCH_ARM 4085 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/arm/stub-cache-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698