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

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

Issue 12494012: new style of property/function callbacks (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: account for apiparameteroperand changes Created 7 years, 7 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 2249 matching lines...) Expand 10 before | Expand all | Expand 10 after
2260 stub->CompilingCallsToThisStubIsGCSafe(isolate())); 2260 stub->CompilingCallsToThisStubIsGCSafe(isolate()));
2261 Jump(stub->GetCode(isolate()), RelocInfo::CODE_TARGET, cond); 2261 Jump(stub->GetCode(isolate()), RelocInfo::CODE_TARGET, cond);
2262 } 2262 }
2263 2263
2264 2264
2265 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { 2265 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) {
2266 return ref0.address() - ref1.address(); 2266 return ref0.address() - ref1.address();
2267 } 2267 }
2268 2268
2269 2269
2270 void MacroAssembler::CallApiFunctionAndReturn(ExternalReference function, 2270 void MacroAssembler::CallApiFunctionAndReturn(
2271 int stack_space) { 2271 void* function_address,
2272 ExternalReference::Type function_type,
2273 int stack_space,
2274 int return_value_operand,
2275 int return_value_offset) {
2272 ExternalReference next_address = 2276 ExternalReference next_address =
2273 ExternalReference::handle_scope_next_address(isolate()); 2277 ExternalReference::handle_scope_next_address(isolate());
2274 const int kNextOffset = 0; 2278 const int kNextOffset = 0;
2275 const int kLimitOffset = AddressOffset( 2279 const int kLimitOffset = AddressOffset(
2276 ExternalReference::handle_scope_limit_address(isolate()), 2280 ExternalReference::handle_scope_limit_address(isolate()),
2277 next_address); 2281 next_address);
2278 const int kLevelOffset = AddressOffset( 2282 const int kLevelOffset = AddressOffset(
2279 ExternalReference::handle_scope_level_address(isolate()), 2283 ExternalReference::handle_scope_level_address(isolate()),
2280 next_address); 2284 next_address);
2281 2285
(...skipping 11 matching lines...) Expand all
2293 PrepareCallCFunction(1, r0); 2297 PrepareCallCFunction(1, r0);
2294 mov(r0, Operand(ExternalReference::isolate_address(isolate()))); 2298 mov(r0, Operand(ExternalReference::isolate_address(isolate())));
2295 CallCFunction(ExternalReference::log_enter_external_function(isolate()), 1); 2299 CallCFunction(ExternalReference::log_enter_external_function(isolate()), 1);
2296 PopSafepointRegisters(); 2300 PopSafepointRegisters();
2297 } 2301 }
2298 2302
2299 // Native call returns to the DirectCEntry stub which redirects to the 2303 // Native call returns to the DirectCEntry stub which redirects to the
2300 // return address pushed on stack (could have moved after GC). 2304 // return address pushed on stack (could have moved after GC).
2301 // DirectCEntry stub itself is generated early and never moves. 2305 // DirectCEntry stub itself is generated early and never moves.
2302 DirectCEntryStub stub; 2306 DirectCEntryStub stub;
2303 stub.GenerateCall(this, function); 2307 {
2308 Address address =
2309 v8::ToCData<Address>(reinterpret_cast<Object*>(function_address));
2310 ApiFunction fun(address);
2311 ExternalReference ref(&fun, function_type, isolate());
2312 stub.GenerateCall(this, ref);
2313 }
2304 2314
2305 if (FLAG_log_timer_events) { 2315 if (FLAG_log_timer_events) {
2306 FrameScope frame(this, StackFrame::MANUAL); 2316 FrameScope frame(this, StackFrame::MANUAL);
2307 PushSafepointRegisters(); 2317 PushSafepointRegisters();
2308 PrepareCallCFunction(1, r0); 2318 PrepareCallCFunction(1, r0);
2309 mov(r0, Operand(ExternalReference::isolate_address(isolate()))); 2319 mov(r0, Operand(ExternalReference::isolate_address(isolate())));
2310 CallCFunction(ExternalReference::log_leave_external_function(isolate()), 1); 2320 CallCFunction(ExternalReference::log_leave_external_function(isolate()), 1);
2311 PopSafepointRegisters(); 2321 PopSafepointRegisters();
2312 } 2322 }
2313 2323
2314 Label promote_scheduled_exception; 2324 Label promote_scheduled_exception;
2315 Label delete_allocated_handles; 2325 Label delete_allocated_handles;
2316 Label leave_exit_frame; 2326 Label leave_exit_frame;
2327 Label return_value_loaded;
2317 2328
2318 // If result is non-zero, dereference to get the result value 2329 if (!CallbackTable::ReturnsVoid(isolate(), function_address)) {
2319 // otherwise set it to undefined. 2330 Label load_return_value;
2320 cmp(r0, Operand::Zero()); 2331 cmp(r0, Operand::Zero());
2321 LoadRoot(r0, Heap::kUndefinedValueRootIndex, eq); 2332 b(eq, &load_return_value);
2322 ldr(r0, MemOperand(r0), ne); 2333 // derefernce returned value
2323 2334 ldr(r0, MemOperand(r0));
2335 b(&return_value_loaded);
2336 bind(&load_return_value);
2337 }
2338 // load value from ReturnValue
2339 ldr(r0, MemOperand(sp, return_value_operand*kPointerSize));
2340 ldr(r0, MemOperand(r0, return_value_offset*kPointerSize));
2341 bind(&return_value_loaded);
2324 // No more valid handles (the result handle was the last one). Restore 2342 // No more valid handles (the result handle was the last one). Restore
2325 // previous handle scope. 2343 // previous handle scope.
2326 str(r4, MemOperand(r7, kNextOffset)); 2344 str(r4, MemOperand(r7, kNextOffset));
2327 if (emit_debug_code()) { 2345 if (emit_debug_code()) {
2328 ldr(r1, MemOperand(r7, kLevelOffset)); 2346 ldr(r1, MemOperand(r7, kLevelOffset));
2329 cmp(r1, r6); 2347 cmp(r1, r6);
2330 Check(eq, "Unexpected level after return from api call"); 2348 Check(eq, "Unexpected level after return from api call");
2331 } 2349 }
2332 sub(r6, r6, Operand(1)); 2350 sub(r6, r6, Operand(1));
2333 str(r6, MemOperand(r7, kLevelOffset)); 2351 str(r6, MemOperand(r7, kLevelOffset));
(...skipping 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after
3858 void CodePatcher::EmitCondition(Condition cond) { 3876 void CodePatcher::EmitCondition(Condition cond) {
3859 Instr instr = Assembler::instr_at(masm_.pc_); 3877 Instr instr = Assembler::instr_at(masm_.pc_);
3860 instr = (instr & ~kCondMask) | cond; 3878 instr = (instr & ~kCondMask) | cond;
3861 masm_.emit(instr); 3879 masm_.emit(instr);
3862 } 3880 }
3863 3881
3864 3882
3865 } } // namespace v8::internal 3883 } } // namespace v8::internal
3866 3884
3867 #endif // V8_TARGET_ARCH_ARM 3885 #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