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

Side by Side Diff: src/arm/code-stubs-arm.cc

Issue 6992072: Implement set trap for proxies, and revamp class hierarchy in preparation (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Renamed range constants for InstanceType enum. 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
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 911 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 __ b(ne, &not_identical); 922 __ b(ne, &not_identical);
923 923
924 // The two objects are identical. If we know that one of them isn't NaN then 924 // The two objects are identical. If we know that one of them isn't NaN then
925 // we now know they test equal. 925 // we now know they test equal.
926 if (cond != eq || !never_nan_nan) { 926 if (cond != eq || !never_nan_nan) {
927 // Test for NaN. Sadly, we can't just compare to FACTORY->nan_value(), 927 // Test for NaN. Sadly, we can't just compare to FACTORY->nan_value(),
928 // so we do the second best thing - test it ourselves. 928 // so we do the second best thing - test it ourselves.
929 // They are both equal and they are not both Smis so both of them are not 929 // They are both equal and they are not both Smis so both of them are not
930 // Smis. If it's not a heap number, then return equal. 930 // Smis. If it's not a heap number, then return equal.
931 if (cond == lt || cond == gt) { 931 if (cond == lt || cond == gt) {
932 __ CompareObjectType(r0, r4, r4, FIRST_JS_OBJECT_TYPE); 932 __ CompareObjectType(r0, r4, r4, FIRST_SPEC_OBJECT_TYPE);
933 __ b(ge, slow); 933 __ b(ge, slow);
934 } else { 934 } else {
935 __ CompareObjectType(r0, r4, r4, HEAP_NUMBER_TYPE); 935 __ CompareObjectType(r0, r4, r4, HEAP_NUMBER_TYPE);
936 __ b(eq, &heap_number); 936 __ b(eq, &heap_number);
937 // Comparing JS objects with <=, >= is complicated. 937 // Comparing JS objects with <=, >= is complicated.
938 if (cond != eq) { 938 if (cond != eq) {
939 __ cmp(r4, Operand(FIRST_JS_OBJECT_TYPE)); 939 __ cmp(r4, Operand(FIRST_SPEC_OBJECT_TYPE));
940 __ b(ge, slow); 940 __ b(ge, slow);
941 // Normally here we fall through to return_equal, but undefined is 941 // Normally here we fall through to return_equal, but undefined is
942 // special: (undefined == undefined) == true, but 942 // special: (undefined == undefined) == true, but
943 // (undefined <= undefined) == false! See ECMAScript 11.8.5. 943 // (undefined <= undefined) == false! See ECMAScript 11.8.5.
944 if (cond == le || cond == ge) { 944 if (cond == le || cond == ge) {
945 __ cmp(r4, Operand(ODDBALL_TYPE)); 945 __ cmp(r4, Operand(ODDBALL_TYPE));
946 __ b(ne, &return_equal); 946 __ b(ne, &return_equal);
947 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); 947 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex);
948 __ cmp(r0, r2); 948 __ cmp(r0, r2);
949 __ b(ne, &return_equal); 949 __ b(ne, &return_equal);
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
1211 } 1211 }
1212 1212
1213 1213
1214 // See comment at call site. 1214 // See comment at call site.
1215 static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm, 1215 static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm,
1216 Register lhs, 1216 Register lhs,
1217 Register rhs) { 1217 Register rhs) {
1218 ASSERT((lhs.is(r0) && rhs.is(r1)) || 1218 ASSERT((lhs.is(r0) && rhs.is(r1)) ||
1219 (lhs.is(r1) && rhs.is(r0))); 1219 (lhs.is(r1) && rhs.is(r0)));
1220 1220
1221 // If either operand is a JSObject or an oddball value, then they are 1221 // If either operand is a JS object or an oddball value, then they are
1222 // not equal since their pointers are different. 1222 // not equal since their pointers are different.
1223 // There is no test for undetectability in strict equality. 1223 // There is no test for undetectability in strict equality.
1224 STATIC_ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); 1224 STATIC_ASSERT(LAST_TYPE == LAST_CALLABLE_SPEC_OBJECT_TYPE);
1225 Label first_non_object; 1225 Label first_non_object;
1226 // Get the type of the first operand into r2 and compare it with 1226 // Get the type of the first operand into r2 and compare it with
1227 // FIRST_JS_OBJECT_TYPE. 1227 // FIRST_SPEC_OBJECT_TYPE.
1228 __ CompareObjectType(rhs, r2, r2, FIRST_JS_OBJECT_TYPE); 1228 __ CompareObjectType(rhs, r2, r2, FIRST_SPEC_OBJECT_TYPE);
1229 __ b(lt, &first_non_object); 1229 __ b(lt, &first_non_object);
1230 1230
1231 // Return non-zero (r0 is not zero) 1231 // Return non-zero (r0 is not zero)
1232 Label return_not_equal; 1232 Label return_not_equal;
1233 __ bind(&return_not_equal); 1233 __ bind(&return_not_equal);
1234 __ Ret(); 1234 __ Ret();
1235 1235
1236 __ bind(&first_non_object); 1236 __ bind(&first_non_object);
1237 // Check for oddballs: true, false, null, undefined. 1237 // Check for oddballs: true, false, null, undefined.
1238 __ cmp(r2, Operand(ODDBALL_TYPE)); 1238 __ cmp(r2, Operand(ODDBALL_TYPE));
1239 __ b(eq, &return_not_equal); 1239 __ b(eq, &return_not_equal);
1240 1240
1241 __ CompareObjectType(lhs, r3, r3, FIRST_JS_OBJECT_TYPE); 1241 __ CompareObjectType(lhs, r3, r3, FIRST_SPEC_OBJECT_TYPE);
1242 __ b(ge, &return_not_equal); 1242 __ b(ge, &return_not_equal);
1243 1243
1244 // Check for oddballs: true, false, null, undefined. 1244 // Check for oddballs: true, false, null, undefined.
1245 __ cmp(r3, Operand(ODDBALL_TYPE)); 1245 __ cmp(r3, Operand(ODDBALL_TYPE));
1246 __ b(eq, &return_not_equal); 1246 __ b(eq, &return_not_equal);
1247 1247
1248 // Now that we have the types we might as well check for symbol-symbol. 1248 // Now that we have the types we might as well check for symbol-symbol.
1249 // Ensure that no non-strings have the symbol bit set. 1249 // Ensure that no non-strings have the symbol bit set.
1250 STATIC_ASSERT(LAST_TYPE < kNotStringTag + kIsSymbolMask); 1250 STATIC_ASSERT(LAST_TYPE < kNotStringTag + kIsSymbolMask);
1251 STATIC_ASSERT(kSymbolTag != 0); 1251 STATIC_ASSERT(kSymbolTag != 0);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1308 __ b(ge, not_both_strings); 1308 __ b(ge, not_both_strings);
1309 __ tst(r3, Operand(kIsSymbolMask)); 1309 __ tst(r3, Operand(kIsSymbolMask));
1310 __ b(eq, possible_strings); 1310 __ b(eq, possible_strings);
1311 1311
1312 // Both are symbols. We already checked they weren't the same pointer 1312 // Both are symbols. We already checked they weren't the same pointer
1313 // so they are not equal. 1313 // so they are not equal.
1314 __ mov(r0, Operand(NOT_EQUAL)); 1314 __ mov(r0, Operand(NOT_EQUAL));
1315 __ Ret(); 1315 __ Ret();
1316 1316
1317 __ bind(&object_test); 1317 __ bind(&object_test);
1318 __ cmp(r2, Operand(FIRST_JS_OBJECT_TYPE)); 1318 __ cmp(r2, Operand(FIRST_SPEC_OBJECT_TYPE));
1319 __ b(lt, not_both_strings); 1319 __ b(lt, not_both_strings);
1320 __ CompareObjectType(lhs, r2, r3, FIRST_JS_OBJECT_TYPE); 1320 __ CompareObjectType(lhs, r2, r3, FIRST_SPEC_OBJECT_TYPE);
1321 __ b(lt, not_both_strings); 1321 __ b(lt, not_both_strings);
1322 // If both objects are undetectable, they are equal. Otherwise, they 1322 // If both objects are undetectable, they are equal. Otherwise, they
1323 // are not equal, since they are different objects and an object is not 1323 // are not equal, since they are different objects and an object is not
1324 // equal to undefined. 1324 // equal to undefined.
1325 __ ldr(r3, FieldMemOperand(rhs, HeapObject::kMapOffset)); 1325 __ ldr(r3, FieldMemOperand(rhs, HeapObject::kMapOffset));
1326 __ ldrb(r2, FieldMemOperand(r2, Map::kBitFieldOffset)); 1326 __ ldrb(r2, FieldMemOperand(r2, Map::kBitFieldOffset));
1327 __ ldrb(r3, FieldMemOperand(r3, Map::kBitFieldOffset)); 1327 __ ldrb(r3, FieldMemOperand(r3, Map::kBitFieldOffset));
1328 __ and_(r0, r2, Operand(r3)); 1328 __ and_(r0, r2, Operand(r3));
1329 __ and_(r0, r0, Operand(1 << Map::kIsUndetectable)); 1329 __ and_(r0, r0, Operand(1 << Map::kIsUndetectable));
1330 __ eor(r0, r0, Operand(1 << Map::kIsUndetectable)); 1330 __ eor(r0, r0, Operand(1 << Map::kIsUndetectable));
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
1670 // Undetectable => false. 1670 // Undetectable => false.
1671 __ ldr(ip, FieldMemOperand(tos_, HeapObject::kMapOffset)); 1671 __ ldr(ip, FieldMemOperand(tos_, HeapObject::kMapOffset));
1672 __ ldrb(scratch, FieldMemOperand(ip, Map::kBitFieldOffset)); 1672 __ ldrb(scratch, FieldMemOperand(ip, Map::kBitFieldOffset));
1673 __ and_(scratch, scratch, Operand(1 << Map::kIsUndetectable)); 1673 __ and_(scratch, scratch, Operand(1 << Map::kIsUndetectable));
1674 __ cmp(scratch, Operand(1 << Map::kIsUndetectable)); 1674 __ cmp(scratch, Operand(1 << Map::kIsUndetectable));
1675 __ b(&false_result, eq); 1675 __ b(&false_result, eq);
1676 1676
1677 // JavaScript object => true. 1677 // JavaScript object => true.
1678 __ ldr(scratch, FieldMemOperand(tos_, HeapObject::kMapOffset)); 1678 __ ldr(scratch, FieldMemOperand(tos_, HeapObject::kMapOffset));
1679 __ ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); 1679 __ ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset));
1680 __ cmp(scratch, Operand(FIRST_JS_OBJECT_TYPE)); 1680 __ cmp(scratch, Operand(FIRST_SPEC_OBJECT_TYPE));
1681 // "tos_" is a register and contains a non-zero value. 1681 // "tos_" is a register and contains a non-zero value.
1682 // Hence we implicitly return true if the greater than 1682 // Hence we implicitly return true if the greater than
1683 // condition is satisfied. 1683 // condition is satisfied.
1684 __ Ret(gt); 1684 __ Ret(gt);
1685 1685
1686 // Check for string 1686 // Check for string
1687 __ ldr(scratch, FieldMemOperand(tos_, HeapObject::kMapOffset)); 1687 __ ldr(scratch, FieldMemOperand(tos_, HeapObject::kMapOffset));
1688 __ ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); 1688 __ ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset));
1689 __ cmp(scratch, Operand(FIRST_NONSTRING_TYPE)); 1689 __ cmp(scratch, Operand(FIRST_NONSTRING_TYPE));
1690 // "tos_" is a register and contains a non-zero value. 1690 // "tos_" is a register and contains a non-zero value.
(...skipping 2802 matching lines...) Expand 10 before | Expand all | Expand 10 after
4493 if (ReceiverMightBeValue()) { 4493 if (ReceiverMightBeValue()) {
4494 // Get the receiver from the stack. 4494 // Get the receiver from the stack.
4495 // function, receiver [, arguments] 4495 // function, receiver [, arguments]
4496 Label receiver_is_value, receiver_is_js_object; 4496 Label receiver_is_value, receiver_is_js_object;
4497 __ ldr(r1, MemOperand(sp, argc_ * kPointerSize)); 4497 __ ldr(r1, MemOperand(sp, argc_ * kPointerSize));
4498 4498
4499 // Check if receiver is a smi (which is a number value). 4499 // Check if receiver is a smi (which is a number value).
4500 __ JumpIfSmi(r1, &receiver_is_value); 4500 __ JumpIfSmi(r1, &receiver_is_value);
4501 4501
4502 // Check if the receiver is a valid JS object. 4502 // Check if the receiver is a valid JS object.
4503 __ CompareObjectType(r1, r2, r2, FIRST_JS_OBJECT_TYPE); 4503 __ CompareObjectType(r1, r2, r2, FIRST_SPEC_OBJECT_TYPE);
4504 __ b(ge, &receiver_is_js_object); 4504 __ b(ge, &receiver_is_js_object);
4505 4505
4506 // Call the runtime to box the value. 4506 // Call the runtime to box the value.
4507 __ bind(&receiver_is_value); 4507 __ bind(&receiver_is_value);
4508 __ EnterInternalFrame(); 4508 __ EnterInternalFrame();
4509 __ push(r1); 4509 __ push(r1);
4510 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); 4510 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION);
4511 __ LeaveInternalFrame(); 4511 __ LeaveInternalFrame();
4512 __ str(r0, MemOperand(sp, argc_ * kPointerSize)); 4512 __ str(r0, MemOperand(sp, argc_ * kPointerSize));
4513 4513
(...skipping 1873 matching lines...) Expand 10 before | Expand all | Expand 10 after
6387 __ mov(result, Operand(0)); 6387 __ mov(result, Operand(0));
6388 __ Ret(); 6388 __ Ret();
6389 } 6389 }
6390 6390
6391 6391
6392 #undef __ 6392 #undef __
6393 6393
6394 } } // namespace v8::internal 6394 } } // namespace v8::internal
6395 6395
6396 #endif // V8_TARGET_ARCH_ARM 6396 #endif // V8_TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698