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

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

Issue 6893156: Unified CallWrapper and PostCallGenerator classes, the former is a (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 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/mips/macro-assembler-mips.h ('k') | src/x64/macro-assembler-x64.h » ('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 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 1640 matching lines...) Expand 10 before | Expand all | Expand 10 after
1651 jr(t9); // Will generate only one instruction. 1651 jr(t9); // Will generate only one instruction.
1652 } 1652 }
1653 } 1653 }
1654 } 1654 }
1655 // Emit a nop in the branch delay slot if required. 1655 // Emit a nop in the branch delay slot if required.
1656 if (bdslot == PROTECT) 1656 if (bdslot == PROTECT)
1657 nop(); 1657 nop();
1658 } 1658 }
1659 1659
1660 1660
1661 int MacroAssembler::CallSize(Handle<Code> code, RelocInfo::Mode rmode) {
1662 UNIMPLEMENTED_MIPS();
1663 return 0;
1664 }
1665
1666
1667 int MacroAssembler::CallSize(Register reg) {
1668 UNIMPLEMENTED_MIPS();
1669 return 0;
1670 }
1671
1672
1661 // Note: To call gcc-compiled C code on mips, you must call thru t9. 1673 // Note: To call gcc-compiled C code on mips, you must call thru t9.
1662 void MacroAssembler::Call(const Operand& target, BranchDelaySlot bdslot) { 1674 void MacroAssembler::Call(const Operand& target, BranchDelaySlot bdslot) {
1663 BlockTrampolinePoolScope block_trampoline_pool(this); 1675 BlockTrampolinePoolScope block_trampoline_pool(this);
1664 if (target.is_reg()) { 1676 if (target.is_reg()) {
1665 jalr(target.rm()); 1677 jalr(target.rm());
1666 } else { // !target.is_reg() 1678 } else { // !target.is_reg()
1667 if (!MustUseReg(target.rmode_)) { 1679 if (!MustUseReg(target.rmode_)) {
1668 jal(target.imm32_); 1680 jal(target.imm32_);
1669 } else { // MustUseReg(target) 1681 } else { // MustUseReg(target)
1670 li(t9, target); 1682 li(t9, target);
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
2236 2248
2237 // ----------------------------------------------------------------------------- 2249 // -----------------------------------------------------------------------------
2238 // JavaScript invokes 2250 // JavaScript invokes
2239 2251
2240 void MacroAssembler::InvokePrologue(const ParameterCount& expected, 2252 void MacroAssembler::InvokePrologue(const ParameterCount& expected,
2241 const ParameterCount& actual, 2253 const ParameterCount& actual,
2242 Handle<Code> code_constant, 2254 Handle<Code> code_constant,
2243 Register code_reg, 2255 Register code_reg,
2244 Label* done, 2256 Label* done,
2245 InvokeFlag flag, 2257 InvokeFlag flag,
2246 PostCallGenerator* post_call_generator) { 2258 CallWrapper* call_wrapper) {
2247 bool definitely_matches = false; 2259 bool definitely_matches = false;
2248 Label regular_invoke; 2260 Label regular_invoke;
2249 2261
2250 // Check whether the expected and actual arguments count match. If not, 2262 // Check whether the expected and actual arguments count match. If not,
2251 // setup registers according to contract with ArgumentsAdaptorTrampoline: 2263 // setup registers according to contract with ArgumentsAdaptorTrampoline:
2252 // a0: actual arguments count 2264 // a0: actual arguments count
2253 // a1: function (passed through to callee) 2265 // a1: function (passed through to callee)
2254 // a2: expected arguments count 2266 // a2: expected arguments count
2255 // a3: callee code entry 2267 // a3: callee code entry
2256 2268
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2289 2301
2290 if (!definitely_matches) { 2302 if (!definitely_matches) {
2291 if (!code_constant.is_null()) { 2303 if (!code_constant.is_null()) {
2292 li(a3, Operand(code_constant)); 2304 li(a3, Operand(code_constant));
2293 addiu(a3, a3, Code::kHeaderSize - kHeapObjectTag); 2305 addiu(a3, a3, Code::kHeaderSize - kHeapObjectTag);
2294 } 2306 }
2295 2307
2296 Handle<Code> adaptor = 2308 Handle<Code> adaptor =
2297 isolate()->builtins()->ArgumentsAdaptorTrampoline(); 2309 isolate()->builtins()->ArgumentsAdaptorTrampoline();
2298 if (flag == CALL_FUNCTION) { 2310 if (flag == CALL_FUNCTION) {
2311 if (call_wrapper != NULL) {
2312 call_wrapper->BeforeCall(CallSize(adaptor, RelocInfo::CODE_TARGET));
2313 }
2299 Call(adaptor, RelocInfo::CODE_TARGET); 2314 Call(adaptor, RelocInfo::CODE_TARGET);
2300 if (post_call_generator != NULL) post_call_generator->Generate(); 2315 if (call_wrapper != NULL) call_wrapper->AfterCall();
2301 jmp(done); 2316 jmp(done);
2302 } else { 2317 } else {
2303 Jump(adaptor, RelocInfo::CODE_TARGET); 2318 Jump(adaptor, RelocInfo::CODE_TARGET);
2304 } 2319 }
2305 bind(&regular_invoke); 2320 bind(&regular_invoke);
2306 } 2321 }
2307 } 2322 }
2308 2323
2309 2324
2310 void MacroAssembler::InvokeCode(Register code, 2325 void MacroAssembler::InvokeCode(Register code,
2311 const ParameterCount& expected, 2326 const ParameterCount& expected,
2312 const ParameterCount& actual, 2327 const ParameterCount& actual,
2313 InvokeFlag flag, 2328 InvokeFlag flag,
2314 PostCallGenerator* post_call_generator) { 2329 CallWrapper* call_wrapper) {
2315 Label done; 2330 Label done;
2316 2331
2317 InvokePrologue(expected, actual, Handle<Code>::null(), code, &done, flag, 2332 InvokePrologue(expected, actual, Handle<Code>::null(), code, &done, flag,
2318 post_call_generator); 2333 call_wrapper);
2319 if (flag == CALL_FUNCTION) { 2334 if (flag == CALL_FUNCTION) {
2320 Call(code); 2335 Call(code);
2321 } else { 2336 } else {
2322 ASSERT(flag == JUMP_FUNCTION); 2337 ASSERT(flag == JUMP_FUNCTION);
2323 Jump(code); 2338 Jump(code);
2324 } 2339 }
2325 // Continue here if InvokePrologue does handle the invocation due to 2340 // Continue here if InvokePrologue does handle the invocation due to
2326 // mismatched parameter counts. 2341 // mismatched parameter counts.
2327 bind(&done); 2342 bind(&done);
2328 } 2343 }
(...skipping 14 matching lines...) Expand all
2343 } 2358 }
2344 // Continue here if InvokePrologue does handle the invocation due to 2359 // Continue here if InvokePrologue does handle the invocation due to
2345 // mismatched parameter counts. 2360 // mismatched parameter counts.
2346 bind(&done); 2361 bind(&done);
2347 } 2362 }
2348 2363
2349 2364
2350 void MacroAssembler::InvokeFunction(Register function, 2365 void MacroAssembler::InvokeFunction(Register function,
2351 const ParameterCount& actual, 2366 const ParameterCount& actual,
2352 InvokeFlag flag, 2367 InvokeFlag flag,
2353 PostCallGenerator* post_call_generator) { 2368 CallWrapper* call_wrapper) {
2354 // Contract with called JS functions requires that function is passed in a1. 2369 // Contract with called JS functions requires that function is passed in a1.
2355 ASSERT(function.is(a1)); 2370 ASSERT(function.is(a1));
2356 Register expected_reg = a2; 2371 Register expected_reg = a2;
2357 Register code_reg = a3; 2372 Register code_reg = a3;
2358 2373
2359 lw(code_reg, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 2374 lw(code_reg, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
2360 lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); 2375 lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset));
2361 lw(expected_reg, 2376 lw(expected_reg,
2362 FieldMemOperand(code_reg, 2377 FieldMemOperand(code_reg,
2363 SharedFunctionInfo::kFormalParameterCountOffset)); 2378 SharedFunctionInfo::kFormalParameterCountOffset));
2364 sra(expected_reg, expected_reg, kSmiTagSize); 2379 sra(expected_reg, expected_reg, kSmiTagSize);
2365 lw(code_reg, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); 2380 lw(code_reg, FieldMemOperand(a1, JSFunction::kCodeEntryOffset));
2366 2381
2367 ParameterCount expected(expected_reg); 2382 ParameterCount expected(expected_reg);
2368 InvokeCode(code_reg, expected, actual, flag, post_call_generator); 2383 InvokeCode(code_reg, expected, actual, flag, call_wrapper);
2369 } 2384 }
2370 2385
2371 2386
2372 void MacroAssembler::InvokeFunction(JSFunction* function, 2387 void MacroAssembler::InvokeFunction(JSFunction* function,
2373 const ParameterCount& actual, 2388 const ParameterCount& actual,
2374 InvokeFlag flag) { 2389 InvokeFlag flag) {
2375 ASSERT(function->is_compiled()); 2390 ASSERT(function->is_compiled());
2376 2391
2377 // Get the function and setup the context. 2392 // Get the function and setup the context.
2378 li(a1, Operand(Handle<JSFunction>(function))); 2393 li(a1, Operand(Handle<JSFunction>(function)));
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
2635 2650
2636 void MacroAssembler::JumpToExternalReference(const ExternalReference& builtin) { 2651 void MacroAssembler::JumpToExternalReference(const ExternalReference& builtin) {
2637 li(a1, Operand(builtin)); 2652 li(a1, Operand(builtin));
2638 CEntryStub stub(1); 2653 CEntryStub stub(1);
2639 Jump(stub.GetCode(), RelocInfo::CODE_TARGET); 2654 Jump(stub.GetCode(), RelocInfo::CODE_TARGET);
2640 } 2655 }
2641 2656
2642 2657
2643 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, 2658 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id,
2644 InvokeFlag flag, 2659 InvokeFlag flag,
2645 PostCallGenerator* post_call_generator) { 2660 CallWrapper* call_wrapper) {
2646 GetBuiltinEntry(t9, id); 2661 GetBuiltinEntry(t9, id);
2647 if (flag == CALL_FUNCTION) { 2662 if (flag == CALL_FUNCTION) {
2663 if (call_wrapper != NULL) call_wrapper->BeforeCall(CallSize(t9));
2648 Call(t9); 2664 Call(t9);
2649 if (post_call_generator != NULL) post_call_generator->Generate(); 2665 if (call_wrapper != NULL) call_wrapper->AfterCall();
2650 } else { 2666 } else {
2651 ASSERT(flag == JUMP_FUNCTION); 2667 ASSERT(flag == JUMP_FUNCTION);
2652 Jump(t9); 2668 Jump(t9);
2653 } 2669 }
2654 } 2670 }
2655 2671
2656 2672
2657 void MacroAssembler::GetBuiltinFunction(Register target, 2673 void MacroAssembler::GetBuiltinFunction(Register target,
2658 Builtins::JavaScript id) { 2674 Builtins::JavaScript id) {
2659 // Load the builtins object into target register. 2675 // Load the builtins object into target register.
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
3318 masm()->emit(reinterpret_cast<Instr>(addr)); 3334 masm()->emit(reinterpret_cast<Instr>(addr));
3319 } 3335 }
3320 3336
3321 3337
3322 #endif // ENABLE_DEBUGGER_SUPPORT 3338 #endif // ENABLE_DEBUGGER_SUPPORT
3323 3339
3324 3340
3325 } } // namespace v8::internal 3341 } } // namespace v8::internal
3326 3342
3327 #endif // V8_TARGET_ARCH_MIPS 3343 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.h ('k') | src/x64/macro-assembler-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698