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

Side by Side Diff: src/arm/code-stubs-arm.cc

Issue 6170001: Direct call api functions (arm implementation) (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 10 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 3295 matching lines...) Expand 10 before | Expand all | Expand 10 after
3306 // sp: stack pointer (restored as callee's sp after C call) 3306 // sp: stack pointer (restored as callee's sp after C call)
3307 // cp: current context (C callee-saved) 3307 // cp: current context (C callee-saved)
3308 3308
3309 // Result returned in r0 or r0+r1 by default. 3309 // Result returned in r0 or r0+r1 by default.
3310 3310
3311 // NOTE: Invocations of builtins may return failure objects 3311 // NOTE: Invocations of builtins may return failure objects
3312 // instead of a proper result. The builtin entry handles 3312 // instead of a proper result. The builtin entry handles
3313 // this by performing a garbage collection and retrying the 3313 // this by performing a garbage collection and retrying the
3314 // builtin once. 3314 // builtin once.
3315 3315
3316 // Compute the argv pointer in a callee-saved register.
3317 __ add(r6, sp, Operand(r0, LSL, kPointerSizeLog2));
3318 __ sub(r6, r6, Operand(kPointerSize));
3319
3316 // Enter the exit frame that transitions from JavaScript to C++. 3320 // Enter the exit frame that transitions from JavaScript to C++.
3317 __ EnterExitFrame(save_doubles_); 3321 __ EnterExitFrame(save_doubles_);
3318 3322
3323 // Setup argc and the builtin function in callee-saved registers.
3324 __ mov(r4, Operand(r0));
3325 __ mov(r5, Operand(r1));
3326
3319 // r4: number of arguments (C callee-saved) 3327 // r4: number of arguments (C callee-saved)
3320 // r5: pointer to builtin function (C callee-saved) 3328 // r5: pointer to builtin function (C callee-saved)
3321 // r6: pointer to first argument (C callee-saved) 3329 // r6: pointer to first argument (C callee-saved)
3322 3330
3323 Label throw_normal_exception; 3331 Label throw_normal_exception;
3324 Label throw_termination_exception; 3332 Label throw_termination_exception;
3325 Label throw_out_of_memory_exception; 3333 Label throw_out_of_memory_exception;
3326 3334
3327 // Call into the runtime system. 3335 // Call into the runtime system.
3328 GenerateCore(masm, 3336 GenerateCore(masm,
(...skipping 2381 matching lines...) Expand 10 before | Expand all | Expand 10 after
5710 __ LeaveInternalFrame(); 5718 __ LeaveInternalFrame();
5711 // Compute the entry point of the rewritten stub. 5719 // Compute the entry point of the rewritten stub.
5712 __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag)); 5720 __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag));
5713 // Restore registers. 5721 // Restore registers.
5714 __ pop(lr); 5722 __ pop(lr);
5715 __ pop(r0); 5723 __ pop(r0);
5716 __ pop(r1); 5724 __ pop(r1);
5717 __ Jump(r2); 5725 __ Jump(r2);
5718 } 5726 }
5719 5727
5728 void DirectCEntryStub::Generate(MacroAssembler* masm) {
5729 __ ldr(pc, MemOperand(sp, 0));
5730 }
5731
5732 void DirectCEntryStub::GenerateCall(MacroAssembler* masm,
5733 ApiFunction *function) {
5734 __ mov(lr, Operand(reinterpret_cast<intptr_t>(GetCode().location()),
5735 RelocInfo::CODE_TARGET));
antonm 2011/02/03 11:16:25 indentation is slightly off.
5736 // Push return address (accessible to GC through exit frame pc).
5737 ExternalReference ref =
5738 ExternalReference(function, ExternalReference::DIRECT_CALL);
5739 __ mov(r2, Operand(reinterpret_cast<intptr_t>(ref.address())));
5740 __ add(ip, pc, Operand(4));
5741 __ str(ip, MemOperand(sp, 0));
5742 __ Jump(r2); // Call the api function.
5743 }
5720 5744
5721 #undef __ 5745 #undef __
5722 5746
5723 } } // namespace v8::internal 5747 } } // namespace v8::internal
5724 5748
5725 #endif // V8_TARGET_ARCH_ARM 5749 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.h ('k') | src/arm/macro-assembler-arm.h » ('j') | src/assembler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698