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

Side by Side Diff: src/arm/builtins-arm.cc

Issue 104663004: Preview of a first step towards unification of hydrogen calls (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merge fix 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 | « no previous file | src/arm/code-stubs-arm.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 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 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 __ sub(r3, r3, Operand(2), SetCC); 598 __ sub(r3, r3, Operand(2), SetCC);
599 __ b(ge, &loop); 599 __ b(ge, &loop);
600 600
601 // Call the function. 601 // Call the function.
602 // r0: number of arguments 602 // r0: number of arguments
603 // r1: constructor function 603 // r1: constructor function
604 if (is_api_function) { 604 if (is_api_function) {
605 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); 605 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
606 Handle<Code> code = 606 Handle<Code> code =
607 masm->isolate()->builtins()->HandleApiCallConstruct(); 607 masm->isolate()->builtins()->HandleApiCallConstruct();
608 ParameterCount expected(0); 608 __ Call(code, RelocInfo::CODE_TARGET);
609 __ InvokeCode(code, expected, expected,
610 RelocInfo::CODE_TARGET, CALL_FUNCTION);
611 } else { 609 } else {
612 ParameterCount actual(r0); 610 ParameterCount actual(r0);
613 __ InvokeFunction(r1, actual, CALL_FUNCTION, NullCallWrapper()); 611 __ InvokeFunction(r1, actual, CALL_FUNCTION, NullCallWrapper());
614 } 612 }
615 613
616 // Store offset of return address for deoptimizer. 614 // Store offset of return address for deoptimizer.
617 if (!is_api_function && !count_constructions) { 615 if (!is_api_function && !count_constructions) {
618 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset()); 616 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset());
619 } 617 }
620 618
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 { Label function, non_proxy; 1141 { Label function, non_proxy;
1144 __ tst(r4, r4); 1142 __ tst(r4, r4);
1145 __ b(eq, &function); 1143 __ b(eq, &function);
1146 // Expected number of arguments is 0 for CALL_NON_FUNCTION. 1144 // Expected number of arguments is 0 for CALL_NON_FUNCTION.
1147 __ mov(r2, Operand::Zero()); 1145 __ mov(r2, Operand::Zero());
1148 __ cmp(r4, Operand(1)); 1146 __ cmp(r4, Operand(1));
1149 __ b(ne, &non_proxy); 1147 __ b(ne, &non_proxy);
1150 1148
1151 __ push(r1); // re-add proxy object as additional argument 1149 __ push(r1); // re-add proxy object as additional argument
1152 __ add(r0, r0, Operand(1)); 1150 __ add(r0, r0, Operand(1));
1153 __ GetBuiltinEntry(r3, Builtins::CALL_FUNCTION_PROXY); 1151 __ GetBuiltinFunction(r1, Builtins::CALL_FUNCTION_PROXY);
1154 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 1152 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
1155 RelocInfo::CODE_TARGET); 1153 RelocInfo::CODE_TARGET);
1156 1154
1157 __ bind(&non_proxy); 1155 __ bind(&non_proxy);
1158 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); 1156 __ GetBuiltinFunction(r1, Builtins::CALL_NON_FUNCTION);
1159 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 1157 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
1160 RelocInfo::CODE_TARGET); 1158 RelocInfo::CODE_TARGET);
1161 __ bind(&function); 1159 __ bind(&function);
1162 } 1160 }
1163 1161
1164 // 5b. Get the code to call from the function and check that the number of 1162 // 5b. Get the code to call from the function and check that the number of
1165 // expected arguments matches what we're providing. If so, jump 1163 // expected arguments matches what we're providing. If so, jump
1166 // (tail-call) to the code in register edx without checking arguments. 1164 // (tail-call) to the code in register edx without checking arguments.
1167 // r0: actual number of arguments 1165 // r0: actual number of arguments
1168 // r1: function 1166 // r1: function
1169 __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); 1167 __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
1170 __ ldr(r2, 1168 __ ldr(r2,
1171 FieldMemOperand(r3, SharedFunctionInfo::kFormalParameterCountOffset)); 1169 FieldMemOperand(r3, SharedFunctionInfo::kFormalParameterCountOffset));
1172 __ SmiUntag(r2); 1170 __ SmiUntag(r2);
1173 __ ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset));
1174 __ cmp(r2, r0); // Check formal and actual parameter counts. 1171 __ cmp(r2, r0); // Check formal and actual parameter counts.
1175 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 1172 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
1176 RelocInfo::CODE_TARGET, 1173 RelocInfo::CODE_TARGET,
1177 ne); 1174 ne);
1178 1175
1176 __ ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset));
1179 ParameterCount expected(0); 1177 ParameterCount expected(0);
1180 __ InvokeCode(r3, expected, expected, JUMP_FUNCTION, NullCallWrapper()); 1178 __ InvokeCode(r3, expected, expected, JUMP_FUNCTION, NullCallWrapper());
1181 } 1179 }
1182 1180
1183 1181
1184 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { 1182 void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
1185 const int kIndexOffset = 1183 const int kIndexOffset =
1186 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize); 1184 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize);
1187 const int kLimitOffset = 1185 const int kLimitOffset =
1188 StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize); 1186 StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize);
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1319 1317
1320 frame_scope.GenerateLeaveFrame(); 1318 frame_scope.GenerateLeaveFrame();
1321 __ add(sp, sp, Operand(3 * kPointerSize)); 1319 __ add(sp, sp, Operand(3 * kPointerSize));
1322 __ Jump(lr); 1320 __ Jump(lr);
1323 1321
1324 // Call the function proxy. 1322 // Call the function proxy.
1325 __ bind(&call_proxy); 1323 __ bind(&call_proxy);
1326 __ push(r1); // add function proxy as last argument 1324 __ push(r1); // add function proxy as last argument
1327 __ add(r0, r0, Operand(1)); 1325 __ add(r0, r0, Operand(1));
1328 __ mov(r2, Operand::Zero()); 1326 __ mov(r2, Operand::Zero());
1329 __ GetBuiltinEntry(r3, Builtins::CALL_FUNCTION_PROXY); 1327 __ GetBuiltinFunction(r1, Builtins::CALL_FUNCTION_PROXY);
1330 __ Call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 1328 __ Call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
1331 RelocInfo::CODE_TARGET); 1329 RelocInfo::CODE_TARGET);
1332 1330
1333 // Tear down the internal frame and remove function, receiver and args. 1331 // Tear down the internal frame and remove function, receiver and args.
1334 } 1332 }
1335 __ add(sp, sp, Operand(3 * kPointerSize)); 1333 __ add(sp, sp, Operand(3 * kPointerSize));
1336 __ Jump(lr); 1334 __ Jump(lr);
1337 } 1335 }
1338 1336
1339 1337
(...skipping 21 matching lines...) Expand all
1361 __ add(sp, sp, Operand::PointerOffsetFromSmiKey(r1)); 1359 __ add(sp, sp, Operand::PointerOffsetFromSmiKey(r1));
1362 __ add(sp, sp, Operand(kPointerSize)); // adjust for receiver 1360 __ add(sp, sp, Operand(kPointerSize)); // adjust for receiver
1363 } 1361 }
1364 1362
1365 1363
1366 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { 1364 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
1367 // ----------- S t a t e ------------- 1365 // ----------- S t a t e -------------
1368 // -- r0 : actual number of arguments 1366 // -- r0 : actual number of arguments
1369 // -- r1 : function (passed through to callee) 1367 // -- r1 : function (passed through to callee)
1370 // -- r2 : expected number of arguments 1368 // -- r2 : expected number of arguments
1371 // -- r3 : code entry to call
1372 // ----------------------------------- 1369 // -----------------------------------
1373 1370
1374 Label invoke, dont_adapt_arguments; 1371 Label invoke, dont_adapt_arguments;
1375 1372
1376 Label enough, too_few; 1373 Label enough, too_few;
1374 __ ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset));
1377 __ cmp(r0, r2); 1375 __ cmp(r0, r2);
1378 __ b(lt, &too_few); 1376 __ b(lt, &too_few);
1379 __ cmp(r2, Operand(SharedFunctionInfo::kDontAdaptArgumentsSentinel)); 1377 __ cmp(r2, Operand(SharedFunctionInfo::kDontAdaptArgumentsSentinel));
1380 __ b(eq, &dont_adapt_arguments); 1378 __ b(eq, &dont_adapt_arguments);
1381 1379
1382 { // Enough parameters: actual >= expected 1380 { // Enough parameters: actual >= expected
1383 __ bind(&enough); 1381 __ bind(&enough);
1384 EnterArgumentsAdaptorFrame(masm); 1382 EnterArgumentsAdaptorFrame(masm);
1385 1383
1386 // Calculate copy start address into r0 and copy end address into r2. 1384 // Calculate copy start address into r0 and copy end address into r2.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1470 __ bind(&dont_adapt_arguments); 1468 __ bind(&dont_adapt_arguments);
1471 __ Jump(r3); 1469 __ Jump(r3);
1472 } 1470 }
1473 1471
1474 1472
1475 #undef __ 1473 #undef __
1476 1474
1477 } } // namespace v8::internal 1475 } } // namespace v8::internal
1478 1476
1479 #endif // V8_TARGET_ARCH_ARM 1477 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/code-stubs-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698