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

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

Issue 7012012: Only send null or undefined as receiver for es5 natives, not generally (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 | « no previous file | src/heap.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 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 // Change context eagerly in case we need the global receiver. 1236 // Change context eagerly in case we need the global receiver.
1237 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); 1237 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
1238 1238
1239 // Do not transform the receiver for strict mode functions. 1239 // Do not transform the receiver for strict mode functions.
1240 __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); 1240 __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
1241 __ ldr(r3, FieldMemOperand(r2, SharedFunctionInfo::kCompilerHintsOffset)); 1241 __ ldr(r3, FieldMemOperand(r2, SharedFunctionInfo::kCompilerHintsOffset));
1242 __ tst(r3, Operand(1 << (SharedFunctionInfo::kStrictModeFunction + 1242 __ tst(r3, Operand(1 << (SharedFunctionInfo::kStrictModeFunction +
1243 kSmiTagSize))); 1243 kSmiTagSize)));
1244 __ b(ne, &shift_arguments); 1244 __ b(ne, &shift_arguments);
1245 1245
1246 // Do not transform the receiver for native (shared already in r2). 1246 // Do not transform the receiver for native (Compilerhints already in r3).
1247 __ ldr(r2, FieldMemOperand(r2, SharedFunctionInfo::kScriptOffset)); 1247 __ tst(r3, Operand(1 << (SharedFunctionInfo::kES5Native +
1248 __ LoadRoot(r3, Heap::kUndefinedValueRootIndex); 1248 kSmiTagSize)));
1249 __ cmp(r2, r3); 1249 __ b(ne, &shift_arguments);
1250 __ b(eq, &shift_arguments);
1251 __ ldr(r2, FieldMemOperand(r2, Script::kTypeOffset));
1252 __ mov(r2, Operand(r2, ASR, kSmiTagSize));
1253 __ cmp(r2, Operand(Script::TYPE_NATIVE));
1254 __ b(eq, &shift_arguments);
1255 1250
1256 // Compute the receiver in non-strict mode. 1251 // Compute the receiver in non-strict mode.
1257 __ add(r2, sp, Operand(r0, LSL, kPointerSizeLog2)); 1252 __ add(r2, sp, Operand(r0, LSL, kPointerSizeLog2));
1258 __ ldr(r2, MemOperand(r2, -kPointerSize)); 1253 __ ldr(r2, MemOperand(r2, -kPointerSize));
1259 // r0: actual number of arguments 1254 // r0: actual number of arguments
1260 // r1: function 1255 // r1: function
1261 // r2: first argument 1256 // r2: first argument
1262 __ tst(r2, Operand(kSmiTagMask)); 1257 __ tst(r2, Operand(kSmiTagMask));
1263 __ b(eq, &convert_to_object); 1258 __ b(eq, &convert_to_object);
1264 1259
1265 // Heap::kUndefinedValueRootIndex is already in r3. 1260 __ LoadRoot(r3, Heap::kUndefinedValueRootIndex);
1266 __ cmp(r2, r3); 1261 __ cmp(r2, r3);
1267 __ b(eq, &use_global_receiver); 1262 __ b(eq, &use_global_receiver);
1268 __ LoadRoot(r3, Heap::kNullValueRootIndex); 1263 __ LoadRoot(r3, Heap::kNullValueRootIndex);
1269 __ cmp(r2, r3); 1264 __ cmp(r2, r3);
1270 __ b(eq, &use_global_receiver); 1265 __ b(eq, &use_global_receiver);
1271 1266
1272 __ CompareObjectType(r2, r3, r3, FIRST_JS_OBJECT_TYPE); 1267 __ CompareObjectType(r2, r3, r3, FIRST_JS_OBJECT_TYPE);
1273 __ b(lt, &convert_to_object); 1268 __ b(lt, &convert_to_object);
1274 __ cmp(r3, Operand(LAST_JS_OBJECT_TYPE)); 1269 __ cmp(r3, Operand(LAST_JS_OBJECT_TYPE));
1275 __ b(le, &shift_arguments); 1270 __ b(le, &shift_arguments);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1424 // Compute the receiver. 1419 // Compute the receiver.
1425 Label call_to_object, use_global_receiver, push_receiver; 1420 Label call_to_object, use_global_receiver, push_receiver;
1426 __ ldr(r0, MemOperand(fp, kRecvOffset)); 1421 __ ldr(r0, MemOperand(fp, kRecvOffset));
1427 1422
1428 // Do not transform the receiver for strict mode functions. 1423 // Do not transform the receiver for strict mode functions.
1429 __ ldr(r2, FieldMemOperand(r1, SharedFunctionInfo::kCompilerHintsOffset)); 1424 __ ldr(r2, FieldMemOperand(r1, SharedFunctionInfo::kCompilerHintsOffset));
1430 __ tst(r2, Operand(1 << (SharedFunctionInfo::kStrictModeFunction + 1425 __ tst(r2, Operand(1 << (SharedFunctionInfo::kStrictModeFunction +
1431 kSmiTagSize))); 1426 kSmiTagSize)));
1432 __ b(ne, &push_receiver); 1427 __ b(ne, &push_receiver);
1433 1428
1434 // Do not transform the receiver for native (shared already in r1). 1429 // Do not transform the receiver for strict mode functions.
1435 __ ldr(r1, FieldMemOperand(r1, SharedFunctionInfo::kScriptOffset)); 1430 __ tst(r2, Operand(1 << (SharedFunctionInfo::kES5Native +
1436 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); 1431 kSmiTagSize)));
1437 __ cmp(r1, r2); 1432 __ b(ne, &push_receiver);
1438 __ b(eq, &push_receiver);
1439 __ ldr(r1, FieldMemOperand(r1, Script::kTypeOffset));
1440 __ mov(r1, Operand(r1, ASR, kSmiTagSize));
1441 __ cmp(r1, Operand(Script::TYPE_NATIVE));
1442 __ b(eq, &push_receiver);
1443 1433
1444 // Compute the receiver in non-strict mode. 1434 // Compute the receiver in non-strict mode.
1445 __ tst(r0, Operand(kSmiTagMask)); 1435 __ tst(r0, Operand(kSmiTagMask));
1446 __ b(eq, &call_to_object); 1436 __ b(eq, &call_to_object);
1447 __ LoadRoot(r1, Heap::kNullValueRootIndex); 1437 __ LoadRoot(r1, Heap::kNullValueRootIndex);
1448 __ cmp(r0, r1); 1438 __ cmp(r0, r1);
1449 __ b(eq, &use_global_receiver); 1439 __ b(eq, &use_global_receiver);
1450 // Heap::kUndefinedValueRootIndex is already in r2. 1440 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex);
1451 __ cmp(r0, r2); 1441 __ cmp(r0, r1);
1452 __ b(eq, &use_global_receiver); 1442 __ b(eq, &use_global_receiver);
1453 1443
1454 // Check if the receiver is already a JavaScript object. 1444 // Check if the receiver is already a JavaScript object.
1455 // r0: receiver 1445 // r0: receiver
1456 __ CompareObjectType(r0, r1, r1, FIRST_JS_OBJECT_TYPE); 1446 __ CompareObjectType(r0, r1, r1, FIRST_JS_OBJECT_TYPE);
1457 __ b(lt, &call_to_object); 1447 __ b(lt, &call_to_object);
1458 __ cmp(r1, Operand(LAST_JS_OBJECT_TYPE)); 1448 __ cmp(r1, Operand(LAST_JS_OBJECT_TYPE));
1459 __ b(le, &push_receiver); 1449 __ b(le, &push_receiver);
1460 1450
1461 // Convert the receiver to a regular object. 1451 // Convert the receiver to a regular object.
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1645 __ bind(&dont_adapt_arguments); 1635 __ bind(&dont_adapt_arguments);
1646 __ Jump(r3); 1636 __ Jump(r3);
1647 } 1637 }
1648 1638
1649 1639
1650 #undef __ 1640 #undef __
1651 1641
1652 } } // namespace v8::internal 1642 } } // namespace v8::internal
1653 1643
1654 #endif // V8_TARGET_ARCH_ARM 1644 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698