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

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

Issue 7039036: Fix calls of strict mode function with an implicit receiver. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comments. 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 | « no previous file | src/arm/code-stubs-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 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 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); 629 __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
630 __ ldr(r2, FieldMemOperand(r2, SharedFunctionInfo::kConstructStubOffset)); 630 __ ldr(r2, FieldMemOperand(r2, SharedFunctionInfo::kConstructStubOffset));
631 __ add(pc, r2, Operand(Code::kHeaderSize - kHeapObjectTag)); 631 __ add(pc, r2, Operand(Code::kHeaderSize - kHeapObjectTag));
632 632
633 // r0: number of arguments 633 // r0: number of arguments
634 // r1: called object 634 // r1: called object
635 __ bind(&non_function_call); 635 __ bind(&non_function_call);
636 // Set expected number of arguments to zero (not changing r0). 636 // Set expected number of arguments to zero (not changing r0).
637 __ mov(r2, Operand(0, RelocInfo::NONE)); 637 __ mov(r2, Operand(0, RelocInfo::NONE));
638 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); 638 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR);
639 __ SetCallKind(r5, CALL_AS_METHOD);
639 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 640 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
640 RelocInfo::CODE_TARGET); 641 RelocInfo::CODE_TARGET);
641 } 642 }
642 643
643 644
644 static void Generate_JSConstructStubHelper(MacroAssembler* masm, 645 static void Generate_JSConstructStubHelper(MacroAssembler* masm,
645 bool is_api_function, 646 bool is_api_function,
646 bool count_constructions) { 647 bool count_constructions) {
647 // Should never count constructions for api objects. 648 // Should never count constructions for api objects.
648 ASSERT(!is_api_function || !count_constructions); 649 ASSERT(!is_api_function || !count_constructions);
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 Generate_JSEntryTrampolineHelper(masm, true); 1071 Generate_JSEntryTrampolineHelper(masm, true);
1071 } 1072 }
1072 1073
1073 1074
1074 void Builtins::Generate_LazyCompile(MacroAssembler* masm) { 1075 void Builtins::Generate_LazyCompile(MacroAssembler* masm) {
1075 // Enter an internal frame. 1076 // Enter an internal frame.
1076 __ EnterInternalFrame(); 1077 __ EnterInternalFrame();
1077 1078
1078 // Preserve the function. 1079 // Preserve the function.
1079 __ push(r1); 1080 __ push(r1);
1081 // Push call kind information.
1082 __ push(r5);
1080 1083
1081 // Push the function on the stack as the argument to the runtime function. 1084 // Push the function on the stack as the argument to the runtime function.
1082 __ push(r1); 1085 __ push(r1);
1083 __ CallRuntime(Runtime::kLazyCompile, 1); 1086 __ CallRuntime(Runtime::kLazyCompile, 1);
1084 // Calculate the entry point. 1087 // Calculate the entry point.
1085 __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag)); 1088 __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag));
1089
1090 // Restore call kind information.
1091 __ pop(r5);
1086 // Restore saved function. 1092 // Restore saved function.
1087 __ pop(r1); 1093 __ pop(r1);
1088 1094
1089 // Tear down temporary frame. 1095 // Tear down temporary frame.
1090 __ LeaveInternalFrame(); 1096 __ LeaveInternalFrame();
1091 1097
1092 // Do a tail-call of the compiled function. 1098 // Do a tail-call of the compiled function.
1093 __ Jump(r2); 1099 __ Jump(r2);
1094 } 1100 }
1095 1101
1096 1102
1097 void Builtins::Generate_LazyRecompile(MacroAssembler* masm) { 1103 void Builtins::Generate_LazyRecompile(MacroAssembler* masm) {
1098 // Enter an internal frame. 1104 // Enter an internal frame.
1099 __ EnterInternalFrame(); 1105 __ EnterInternalFrame();
1100 1106
1101 // Preserve the function. 1107 // Preserve the function.
1102 __ push(r1); 1108 __ push(r1);
1109 // Push call kind information.
1110 __ push(r5);
1103 1111
1104 // Push the function on the stack as the argument to the runtime function. 1112 // Push the function on the stack as the argument to the runtime function.
1105 __ push(r1); 1113 __ push(r1);
1106 __ CallRuntime(Runtime::kLazyRecompile, 1); 1114 __ CallRuntime(Runtime::kLazyRecompile, 1);
1107 // Calculate the entry point. 1115 // Calculate the entry point.
1108 __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag)); 1116 __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag));
1117
1118 // Restore call kind information.
1119 __ pop(r5);
1109 // Restore saved function. 1120 // Restore saved function.
1110 __ pop(r1); 1121 __ pop(r1);
1111 1122
1112 // Tear down temporary frame. 1123 // Tear down temporary frame.
1113 __ LeaveInternalFrame(); 1124 __ LeaveInternalFrame();
1114 1125
1115 // Do a tail-call of the compiled function. 1126 // Do a tail-call of the compiled function.
1116 __ Jump(r2); 1127 __ Jump(r2);
1117 } 1128 }
1118 1129
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1338 1349
1339 // 5a. Call non-function via tail call to CALL_NON_FUNCTION builtin. 1350 // 5a. Call non-function via tail call to CALL_NON_FUNCTION builtin.
1340 // r0: actual number of arguments 1351 // r0: actual number of arguments
1341 // r1: function 1352 // r1: function
1342 { Label function; 1353 { Label function;
1343 __ tst(r1, r1); 1354 __ tst(r1, r1);
1344 __ b(ne, &function); 1355 __ b(ne, &function);
1345 // Expected number of arguments is 0 for CALL_NON_FUNCTION. 1356 // Expected number of arguments is 0 for CALL_NON_FUNCTION.
1346 __ mov(r2, Operand(0, RelocInfo::NONE)); 1357 __ mov(r2, Operand(0, RelocInfo::NONE));
1347 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); 1358 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION);
1359 __ SetCallKind(r5, CALL_AS_METHOD);
1348 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 1360 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
1349 RelocInfo::CODE_TARGET); 1361 RelocInfo::CODE_TARGET);
1350 __ bind(&function); 1362 __ bind(&function);
1351 } 1363 }
1352 1364
1353 // 5b. Get the code to call from the function and check that the number of 1365 // 5b. Get the code to call from the function and check that the number of
1354 // expected arguments matches what we're providing. If so, jump 1366 // expected arguments matches what we're providing. If so, jump
1355 // (tail-call) to the code in register edx without checking arguments. 1367 // (tail-call) to the code in register edx without checking arguments.
1356 // r0: actual number of arguments 1368 // r0: actual number of arguments
1357 // r1: function 1369 // r1: function
1358 __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); 1370 __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
1359 __ ldr(r2, 1371 __ ldr(r2,
1360 FieldMemOperand(r3, SharedFunctionInfo::kFormalParameterCountOffset)); 1372 FieldMemOperand(r3, SharedFunctionInfo::kFormalParameterCountOffset));
1361 __ mov(r2, Operand(r2, ASR, kSmiTagSize)); 1373 __ mov(r2, Operand(r2, ASR, kSmiTagSize));
1362 __ ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); 1374 __ ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset));
1375 __ SetCallKind(r5, CALL_AS_METHOD);
1363 __ cmp(r2, r0); // Check formal and actual parameter counts. 1376 __ cmp(r2, r0); // Check formal and actual parameter counts.
1364 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 1377 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
1365 RelocInfo::CODE_TARGET, 1378 RelocInfo::CODE_TARGET,
1366 ne); 1379 ne);
1367 1380
1368 ParameterCount expected(0); 1381 ParameterCount expected(0);
1369 __ InvokeCode(r3, expected, expected, JUMP_FUNCTION); 1382 __ InvokeCode(r3, expected, expected, JUMP_FUNCTION);
1370 } 1383 }
1371 1384
1372 1385
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1532 __ add(sp, sp, Operand(kPointerSize)); // adjust for receiver 1545 __ add(sp, sp, Operand(kPointerSize)); // adjust for receiver
1533 } 1546 }
1534 1547
1535 1548
1536 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { 1549 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
1537 // ----------- S t a t e ------------- 1550 // ----------- S t a t e -------------
1538 // -- r0 : actual number of arguments 1551 // -- r0 : actual number of arguments
1539 // -- r1 : function (passed through to callee) 1552 // -- r1 : function (passed through to callee)
1540 // -- r2 : expected number of arguments 1553 // -- r2 : expected number of arguments
1541 // -- r3 : code entry to call 1554 // -- r3 : code entry to call
1555 // -- r5 : call kind information
1542 // ----------------------------------- 1556 // -----------------------------------
1543 1557
1544 Label invoke, dont_adapt_arguments; 1558 Label invoke, dont_adapt_arguments;
1545 1559
1546 Label enough, too_few; 1560 Label enough, too_few;
1547 __ cmp(r0, r2); 1561 __ cmp(r0, r2);
1548 __ b(lt, &too_few); 1562 __ b(lt, &too_few);
1549 __ cmp(r2, Operand(SharedFunctionInfo::kDontAdaptArgumentsSentinel)); 1563 __ cmp(r2, Operand(SharedFunctionInfo::kDontAdaptArgumentsSentinel));
1550 __ b(eq, &dont_adapt_arguments); 1564 __ b(eq, &dont_adapt_arguments);
1551 1565
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1635 __ bind(&dont_adapt_arguments); 1649 __ bind(&dont_adapt_arguments);
1636 __ Jump(r3); 1650 __ Jump(r3);
1637 } 1651 }
1638 1652
1639 1653
1640 #undef __ 1654 #undef __
1641 1655
1642 } } // namespace v8::internal 1656 } } // namespace v8::internal
1643 1657
1644 #endif // V8_TARGET_ARCH_ARM 1658 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/code-stubs-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698