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

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

Issue 7062007: Avoid calling ToObject on JSFunction receiver arguments for Function.call and Function.apply. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add static asserts. 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/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 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 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after
1257 __ tst(r2, Operand(kSmiTagMask)); 1257 __ tst(r2, Operand(kSmiTagMask));
1258 __ b(eq, &convert_to_object); 1258 __ b(eq, &convert_to_object);
1259 1259
1260 __ LoadRoot(r3, Heap::kUndefinedValueRootIndex); 1260 __ LoadRoot(r3, Heap::kUndefinedValueRootIndex);
1261 __ cmp(r2, r3); 1261 __ cmp(r2, r3);
1262 __ b(eq, &use_global_receiver); 1262 __ b(eq, &use_global_receiver);
1263 __ LoadRoot(r3, Heap::kNullValueRootIndex); 1263 __ LoadRoot(r3, Heap::kNullValueRootIndex);
1264 __ cmp(r2, r3); 1264 __ cmp(r2, r3);
1265 __ b(eq, &use_global_receiver); 1265 __ b(eq, &use_global_receiver);
1266 1266
1267 STATIC_ASSERT(LAST_JS_OBJECT_TYPE + 1 == LAST_TYPE);
1268 STATIC_ASSERT(LAST_TYPE == JS_FUNCTION_TYPE);
1267 __ CompareObjectType(r2, r3, r3, FIRST_JS_OBJECT_TYPE); 1269 __ CompareObjectType(r2, r3, r3, FIRST_JS_OBJECT_TYPE);
1268 __ b(lt, &convert_to_object); 1270 __ b(ge, &shift_arguments);
1269 __ cmp(r3, Operand(LAST_JS_OBJECT_TYPE));
1270 __ b(le, &shift_arguments);
1271 1271
1272 __ bind(&convert_to_object); 1272 __ bind(&convert_to_object);
1273 __ EnterInternalFrame(); // In order to preserve argument count. 1273 __ EnterInternalFrame(); // In order to preserve argument count.
1274 __ mov(r0, Operand(r0, LSL, kSmiTagSize)); // Smi-tagged. 1274 __ mov(r0, Operand(r0, LSL, kSmiTagSize)); // Smi-tagged.
1275 __ push(r0); 1275 __ push(r0);
1276 1276
1277 __ push(r2); 1277 __ push(r2);
1278 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); 1278 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION);
1279 __ mov(r2, r0); 1279 __ mov(r2, r0);
1280 1280
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1436 __ b(eq, &call_to_object); 1436 __ b(eq, &call_to_object);
1437 __ LoadRoot(r1, Heap::kNullValueRootIndex); 1437 __ LoadRoot(r1, Heap::kNullValueRootIndex);
1438 __ cmp(r0, r1); 1438 __ cmp(r0, r1);
1439 __ b(eq, &use_global_receiver); 1439 __ b(eq, &use_global_receiver);
1440 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); 1440 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex);
1441 __ cmp(r0, r1); 1441 __ cmp(r0, r1);
1442 __ b(eq, &use_global_receiver); 1442 __ b(eq, &use_global_receiver);
1443 1443
1444 // Check if the receiver is already a JavaScript object. 1444 // Check if the receiver is already a JavaScript object.
1445 // r0: receiver 1445 // r0: receiver
1446 STATIC_ASSERT(LAST_JS_OBJECT_TYPE + 1 == LAST_TYPE);
1447 STATIC_ASSERT(LAST_TYPE == JS_FUNCTION_TYPE);
1446 __ CompareObjectType(r0, r1, r1, FIRST_JS_OBJECT_TYPE); 1448 __ CompareObjectType(r0, r1, r1, FIRST_JS_OBJECT_TYPE);
1447 __ b(lt, &call_to_object); 1449 __ b(ge, &push_receiver);
1448 __ cmp(r1, Operand(LAST_JS_OBJECT_TYPE));
1449 __ b(le, &push_receiver);
1450 1450
1451 // Convert the receiver to a regular object. 1451 // Convert the receiver to a regular object.
1452 // r0: receiver 1452 // r0: receiver
1453 __ bind(&call_to_object); 1453 __ bind(&call_to_object);
1454 __ push(r0); 1454 __ push(r0);
1455 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); 1455 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION);
1456 __ b(&push_receiver); 1456 __ b(&push_receiver);
1457 1457
1458 // Use the current global receiver object as the receiver. 1458 // Use the current global receiver object as the receiver.
1459 __ bind(&use_global_receiver); 1459 __ bind(&use_global_receiver);
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1635 __ bind(&dont_adapt_arguments); 1635 __ bind(&dont_adapt_arguments);
1636 __ Jump(r3); 1636 __ Jump(r3);
1637 } 1637 }
1638 1638
1639 1639
1640 #undef __ 1640 #undef __
1641 1641
1642 } } // namespace v8::internal 1642 } } // namespace v8::internal
1643 1643
1644 #endif // V8_TARGET_ARCH_ARM 1644 #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