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

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

Issue 6909026: Additional minor cleanup regarding CallWrapper: Use the null object pattern. (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/lithium-codegen-x64.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 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 2237 matching lines...) Expand 10 before | Expand all | Expand 10 after
2248 2248
2249 // ----------------------------------------------------------------------------- 2249 // -----------------------------------------------------------------------------
2250 // JavaScript invokes 2250 // JavaScript invokes
2251 2251
2252 void MacroAssembler::InvokePrologue(const ParameterCount& expected, 2252 void MacroAssembler::InvokePrologue(const ParameterCount& expected,
2253 const ParameterCount& actual, 2253 const ParameterCount& actual,
2254 Handle<Code> code_constant, 2254 Handle<Code> code_constant,
2255 Register code_reg, 2255 Register code_reg,
2256 Label* done, 2256 Label* done,
2257 InvokeFlag flag, 2257 InvokeFlag flag,
2258 CallWrapper* call_wrapper) { 2258 const CallWrapper& call_wrapper) {
2259 bool definitely_matches = false; 2259 bool definitely_matches = false;
2260 Label regular_invoke; 2260 Label regular_invoke;
2261 2261
2262 // Check whether the expected and actual arguments count match. If not, 2262 // Check whether the expected and actual arguments count match. If not,
2263 // setup registers according to contract with ArgumentsAdaptorTrampoline: 2263 // setup registers according to contract with ArgumentsAdaptorTrampoline:
2264 // a0: actual arguments count 2264 // a0: actual arguments count
2265 // a1: function (passed through to callee) 2265 // a1: function (passed through to callee)
2266 // a2: expected arguments count 2266 // a2: expected arguments count
2267 // a3: callee code entry 2267 // a3: callee code entry
2268 2268
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2301 2301
2302 if (!definitely_matches) { 2302 if (!definitely_matches) {
2303 if (!code_constant.is_null()) { 2303 if (!code_constant.is_null()) {
2304 li(a3, Operand(code_constant)); 2304 li(a3, Operand(code_constant));
2305 addiu(a3, a3, Code::kHeaderSize - kHeapObjectTag); 2305 addiu(a3, a3, Code::kHeaderSize - kHeapObjectTag);
2306 } 2306 }
2307 2307
2308 Handle<Code> adaptor = 2308 Handle<Code> adaptor =
2309 isolate()->builtins()->ArgumentsAdaptorTrampoline(); 2309 isolate()->builtins()->ArgumentsAdaptorTrampoline();
2310 if (flag == CALL_FUNCTION) { 2310 if (flag == CALL_FUNCTION) {
2311 if (call_wrapper != NULL) { 2311 call_wrapper.BeforeCall(CallSize(adaptor, RelocInfo::CODE_TARGET));
2312 call_wrapper->BeforeCall(CallSize(adaptor, RelocInfo::CODE_TARGET));
2313 }
2314 Call(adaptor, RelocInfo::CODE_TARGET); 2312 Call(adaptor, RelocInfo::CODE_TARGET);
2315 if (call_wrapper != NULL) call_wrapper->AfterCall(); 2313 call_wrapper.AfterCall();
2316 jmp(done); 2314 jmp(done);
2317 } else { 2315 } else {
2318 Jump(adaptor, RelocInfo::CODE_TARGET); 2316 Jump(adaptor, RelocInfo::CODE_TARGET);
2319 } 2317 }
2320 bind(&regular_invoke); 2318 bind(&regular_invoke);
2321 } 2319 }
2322 } 2320 }
2323 2321
2324 2322
2325 void MacroAssembler::InvokeCode(Register code, 2323 void MacroAssembler::InvokeCode(Register code,
2326 const ParameterCount& expected, 2324 const ParameterCount& expected,
2327 const ParameterCount& actual, 2325 const ParameterCount& actual,
2328 InvokeFlag flag, 2326 InvokeFlag flag,
2329 CallWrapper* call_wrapper) { 2327 const CallWrapper& call_wrapper) {
2330 Label done; 2328 Label done;
2331 2329
2332 InvokePrologue(expected, actual, Handle<Code>::null(), code, &done, flag, 2330 InvokePrologue(expected, actual, Handle<Code>::null(), code, &done, flag,
2333 call_wrapper); 2331 call_wrapper);
2334 if (flag == CALL_FUNCTION) { 2332 if (flag == CALL_FUNCTION) {
2335 Call(code); 2333 Call(code);
2336 } else { 2334 } else {
2337 ASSERT(flag == JUMP_FUNCTION); 2335 ASSERT(flag == JUMP_FUNCTION);
2338 Jump(code); 2336 Jump(code);
2339 } 2337 }
(...skipping 18 matching lines...) Expand all
2358 } 2356 }
2359 // Continue here if InvokePrologue does handle the invocation due to 2357 // Continue here if InvokePrologue does handle the invocation due to
2360 // mismatched parameter counts. 2358 // mismatched parameter counts.
2361 bind(&done); 2359 bind(&done);
2362 } 2360 }
2363 2361
2364 2362
2365 void MacroAssembler::InvokeFunction(Register function, 2363 void MacroAssembler::InvokeFunction(Register function,
2366 const ParameterCount& actual, 2364 const ParameterCount& actual,
2367 InvokeFlag flag, 2365 InvokeFlag flag,
2368 CallWrapper* call_wrapper) { 2366 const CallWrapper& call_wrapper) {
2369 // Contract with called JS functions requires that function is passed in a1. 2367 // Contract with called JS functions requires that function is passed in a1.
2370 ASSERT(function.is(a1)); 2368 ASSERT(function.is(a1));
2371 Register expected_reg = a2; 2369 Register expected_reg = a2;
2372 Register code_reg = a3; 2370 Register code_reg = a3;
2373 2371
2374 lw(code_reg, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 2372 lw(code_reg, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
2375 lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); 2373 lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset));
2376 lw(expected_reg, 2374 lw(expected_reg,
2377 FieldMemOperand(code_reg, 2375 FieldMemOperand(code_reg,
2378 SharedFunctionInfo::kFormalParameterCountOffset)); 2376 SharedFunctionInfo::kFormalParameterCountOffset));
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
2650 2648
2651 void MacroAssembler::JumpToExternalReference(const ExternalReference& builtin) { 2649 void MacroAssembler::JumpToExternalReference(const ExternalReference& builtin) {
2652 li(a1, Operand(builtin)); 2650 li(a1, Operand(builtin));
2653 CEntryStub stub(1); 2651 CEntryStub stub(1);
2654 Jump(stub.GetCode(), RelocInfo::CODE_TARGET); 2652 Jump(stub.GetCode(), RelocInfo::CODE_TARGET);
2655 } 2653 }
2656 2654
2657 2655
2658 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, 2656 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id,
2659 InvokeFlag flag, 2657 InvokeFlag flag,
2660 CallWrapper* call_wrapper) { 2658 const CallWrapper& call_wrapper) {
2661 GetBuiltinEntry(t9, id); 2659 GetBuiltinEntry(t9, id);
2662 if (flag == CALL_FUNCTION) { 2660 if (flag == CALL_FUNCTION) {
2663 if (call_wrapper != NULL) call_wrapper->BeforeCall(CallSize(t9)); 2661 call_wrapper.BeforeCall(CallSize(t9));
2664 Call(t9); 2662 Call(t9);
2665 if (call_wrapper != NULL) call_wrapper->AfterCall(); 2663 call_wrapper.AfterCall();
2666 } else { 2664 } else {
2667 ASSERT(flag == JUMP_FUNCTION); 2665 ASSERT(flag == JUMP_FUNCTION);
2668 Jump(t9); 2666 Jump(t9);
2669 } 2667 }
2670 } 2668 }
2671 2669
2672 2670
2673 void MacroAssembler::GetBuiltinFunction(Register target, 2671 void MacroAssembler::GetBuiltinFunction(Register target,
2674 Builtins::JavaScript id) { 2672 Builtins::JavaScript id) {
2675 // Load the builtins object into target register. 2673 // Load the builtins object into target register.
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
3334 masm()->emit(reinterpret_cast<Instr>(addr)); 3332 masm()->emit(reinterpret_cast<Instr>(addr));
3335 } 3333 }
3336 3334
3337 3335
3338 #endif // ENABLE_DEBUGGER_SUPPORT 3336 #endif // ENABLE_DEBUGGER_SUPPORT
3339 3337
3340 3338
3341 } } // namespace v8::internal 3339 } } // namespace v8::internal
3342 3340
3343 #endif // V8_TARGET_ARCH_MIPS 3341 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.h ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698