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

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

Issue 6524006: Strict mode function entry (Function.prototype.call/apply) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix presubmit. 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
« no previous file with comments | « no previous file | src/ia32/builtins-ia32.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 __ b(ne, &non_function); 1224 __ b(ne, &non_function);
1225 1225
1226 // 3a. Patch the first argument if necessary when calling a function. 1226 // 3a. Patch the first argument if necessary when calling a function.
1227 // r0: actual number of arguments 1227 // r0: actual number of arguments
1228 // r1: function 1228 // r1: function
1229 Label shift_arguments; 1229 Label shift_arguments;
1230 { Label convert_to_object, use_global_receiver, patch_receiver; 1230 { Label convert_to_object, use_global_receiver, patch_receiver;
1231 // Change context eagerly in case we need the global receiver. 1231 // Change context eagerly in case we need the global receiver.
1232 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); 1232 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
1233 1233
1234 // Do not transform the receiver for strict mode functions.
1235 __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
1236 __ ldr(r2, FieldMemOperand(r2, SharedFunctionInfo::kCompilerHintsOffset));
1237 __ tst(r2, Operand(1 << (SharedFunctionInfo::kStrictModeFunction +
1238 kSmiTagSize)));
1239 __ b(ne, &shift_arguments);
1240
1241 // Compute the receiver in non-strict mode.
1234 __ add(r2, sp, Operand(r0, LSL, kPointerSizeLog2)); 1242 __ add(r2, sp, Operand(r0, LSL, kPointerSizeLog2));
1235 __ ldr(r2, MemOperand(r2, -kPointerSize)); 1243 __ ldr(r2, MemOperand(r2, -kPointerSize));
1236 // r0: actual number of arguments 1244 // r0: actual number of arguments
1237 // r1: function 1245 // r1: function
1238 // r2: first argument 1246 // r2: first argument
1239 __ tst(r2, Operand(kSmiTagMask)); 1247 __ tst(r2, Operand(kSmiTagMask));
1240 __ b(eq, &convert_to_object); 1248 __ b(eq, &convert_to_object);
1241 1249
1242 __ LoadRoot(r3, Heap::kNullValueRootIndex); 1250 __ LoadRoot(r3, Heap::kNullValueRootIndex);
1243 __ cmp(r2, r3); 1251 __ cmp(r2, r3);
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 1395
1388 // Push current limit and index. 1396 // Push current limit and index.
1389 __ bind(&okay); 1397 __ bind(&okay);
1390 __ push(r0); // limit 1398 __ push(r0); // limit
1391 __ mov(r1, Operand(0, RelocInfo::NONE)); // initial index 1399 __ mov(r1, Operand(0, RelocInfo::NONE)); // initial index
1392 __ push(r1); 1400 __ push(r1);
1393 1401
1394 // Change context eagerly to get the right global object if necessary. 1402 // Change context eagerly to get the right global object if necessary.
1395 __ ldr(r0, MemOperand(fp, kFunctionOffset)); 1403 __ ldr(r0, MemOperand(fp, kFunctionOffset));
1396 __ ldr(cp, FieldMemOperand(r0, JSFunction::kContextOffset)); 1404 __ ldr(cp, FieldMemOperand(r0, JSFunction::kContextOffset));
1405 // Load the shared function info while the function is still in r0.
1406 __ ldr(r1, FieldMemOperand(r0, JSFunction::kSharedFunctionInfoOffset));
1397 1407
1398 // Compute the receiver. 1408 // Compute the receiver.
1399 Label call_to_object, use_global_receiver, push_receiver; 1409 Label call_to_object, use_global_receiver, push_receiver;
1400 __ ldr(r0, MemOperand(fp, kRecvOffset)); 1410 __ ldr(r0, MemOperand(fp, kRecvOffset));
1411
1412 // Do not transform the receiver for strict mode functions.
1413 __ ldr(r1, FieldMemOperand(r1, SharedFunctionInfo::kCompilerHintsOffset));
1414 __ tst(r1, Operand(1 << (SharedFunctionInfo::kStrictModeFunction +
1415 kSmiTagSize)));
1416 __ b(ne, &push_receiver);
1417
1418 // Compute the receiver in non-strict mode.
1401 __ tst(r0, Operand(kSmiTagMask)); 1419 __ tst(r0, Operand(kSmiTagMask));
1402 __ b(eq, &call_to_object); 1420 __ b(eq, &call_to_object);
1403 __ LoadRoot(r1, Heap::kNullValueRootIndex); 1421 __ LoadRoot(r1, Heap::kNullValueRootIndex);
1404 __ cmp(r0, r1); 1422 __ cmp(r0, r1);
1405 __ b(eq, &use_global_receiver); 1423 __ b(eq, &use_global_receiver);
1406 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); 1424 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex);
1407 __ cmp(r0, r1); 1425 __ cmp(r0, r1);
1408 __ b(eq, &use_global_receiver); 1426 __ b(eq, &use_global_receiver);
1409 1427
1410 // Check if the receiver is already a JavaScript object. 1428 // Check if the receiver is already a JavaScript object.
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1601 __ bind(&dont_adapt_arguments); 1619 __ bind(&dont_adapt_arguments);
1602 __ Jump(r3); 1620 __ Jump(r3);
1603 } 1621 }
1604 1622
1605 1623
1606 #undef __ 1624 #undef __
1607 1625
1608 } } // namespace v8::internal 1626 } } // namespace v8::internal
1609 1627
1610 #endif // V8_TARGET_ARCH_ARM 1628 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/ia32/builtins-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698