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

Side by Side Diff: src/x64/stub-cache-x64.cc

Issue 4100005: Version 2.5.2 (Closed)
Patch Set: Created 10 years, 1 month 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
« no previous file with comments | « src/x64/simulator-x64.h ('k') | test/cctest/test-alloc.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 778 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 789
790 StubCompiler* stub_compiler_; 790 StubCompiler* stub_compiler_;
791 const ParameterCount& arguments_; 791 const ParameterCount& arguments_;
792 Register name_; 792 Register name_;
793 }; 793 };
794 794
795 795
796 // Generate code to check that a global property cell is empty. Create 796 // Generate code to check that a global property cell is empty. Create
797 // the property cell at compilation time if no cell exists for the 797 // the property cell at compilation time if no cell exists for the
798 // property. 798 // property.
799 static Object* GenerateCheckPropertyCell(MacroAssembler* masm, 799 MUST_USE_RESULT static MaybeObject* GenerateCheckPropertyCell(
800 GlobalObject* global, 800 MacroAssembler* masm,
801 String* name, 801 GlobalObject* global,
802 Register scratch, 802 String* name,
803 Label* miss) { 803 Register scratch,
804 Object* probe = global->EnsurePropertyCell(name); 804 Label* miss) {
805 if (probe->IsFailure()) return probe; 805 Object* probe;
806 { MaybeObject* maybe_probe = global->EnsurePropertyCell(name);
807 if (!maybe_probe->ToObject(&probe)) return maybe_probe;
808 }
806 JSGlobalPropertyCell* cell = JSGlobalPropertyCell::cast(probe); 809 JSGlobalPropertyCell* cell = JSGlobalPropertyCell::cast(probe);
807 ASSERT(cell->value()->IsTheHole()); 810 ASSERT(cell->value()->IsTheHole());
808 __ Move(scratch, Handle<Object>(cell)); 811 __ Move(scratch, Handle<Object>(cell));
809 __ Cmp(FieldOperand(scratch, JSGlobalPropertyCell::kValueOffset), 812 __ Cmp(FieldOperand(scratch, JSGlobalPropertyCell::kValueOffset),
810 Factory::the_hole_value()); 813 Factory::the_hole_value());
811 __ j(not_equal, miss); 814 __ j(not_equal, miss);
812 return cell; 815 return cell;
813 } 816 }
814 817
815 818
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 __ Move(rax, Handle<SharedFunctionInfo>(function->shared())); 875 __ Move(rax, Handle<SharedFunctionInfo>(function->shared()));
873 __ cmpq(FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset), rax); 876 __ cmpq(FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset), rax);
874 __ j(not_equal, miss); 877 __ j(not_equal, miss);
875 } else { 878 } else {
876 __ Cmp(rdi, Handle<JSFunction>(function)); 879 __ Cmp(rdi, Handle<JSFunction>(function));
877 __ j(not_equal, miss); 880 __ j(not_equal, miss);
878 } 881 }
879 } 882 }
880 883
881 884
882 Object* CallStubCompiler::GenerateMissBranch() { 885 MaybeObject* CallStubCompiler::GenerateMissBranch() {
883 Object* obj = StubCache::ComputeCallMiss(arguments().immediate(), kind_); 886 Object* obj;
884 if (obj->IsFailure()) return obj; 887 { MaybeObject* maybe_obj =
888 StubCache::ComputeCallMiss(arguments().immediate(), kind_);
889 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
890 }
885 __ Jump(Handle<Code>(Code::cast(obj)), RelocInfo::CODE_TARGET); 891 __ Jump(Handle<Code>(Code::cast(obj)), RelocInfo::CODE_TARGET);
886 return obj; 892 return obj;
887 } 893 }
888 894
889 895
890 Object* CallStubCompiler::CompileCallConstant(Object* object, 896 MaybeObject* CallStubCompiler::CompileCallConstant(
891 JSObject* holder, 897 Object* object,
892 JSFunction* function, 898 JSObject* holder,
893 String* name, 899 JSFunction* function,
894 StubCompiler::CheckType check) { 900 String* name,
901 StubCompiler::CheckType check) {
895 // ----------- S t a t e ------------- 902 // ----------- S t a t e -------------
896 // rcx : function name 903 // rcx : function name
897 // rsp[0] : return address 904 // rsp[0] : return address
898 // rsp[8] : argument argc 905 // rsp[8] : argument argc
899 // rsp[16] : argument argc - 1 906 // rsp[16] : argument argc - 1
900 // ... 907 // ...
901 // rsp[argc * 8] : argument 1 908 // rsp[argc * 8] : argument 1
902 // rsp[(argc + 1) * 8] : argument 0 = receiver 909 // rsp[(argc + 1) * 8] : argument 0 = receiver
903 // ----------------------------------- 910 // -----------------------------------
904 911
905 SharedFunctionInfo* function_info = function->shared(); 912 SharedFunctionInfo* function_info = function->shared();
906 if (function_info->HasCustomCallGenerator()) { 913 if (function_info->HasCustomCallGenerator()) {
907 const int id = function_info->custom_call_generator_id(); 914 const int id = function_info->custom_call_generator_id();
908 Object* result = CompileCustomCall( 915 MaybeObject* maybe_result = CompileCustomCall(
909 id, object, holder, NULL, function, name); 916 id, object, holder, NULL, function, name);
917 Object* result;
918 if (!maybe_result->ToObject(&result)) return maybe_result;
910 // undefined means bail out to regular compiler. 919 // undefined means bail out to regular compiler.
911 if (!result->IsUndefined()) return result; 920 if (!result->IsUndefined()) return result;
912 } 921 }
913 922
914 Label miss_in_smi_check; 923 Label miss_in_smi_check;
915 924
916 GenerateNameCheck(name, &miss_in_smi_check); 925 GenerateNameCheck(name, &miss_in_smi_check);
917 926
918 // Get the receiver from the stack. 927 // Get the receiver from the stack.
919 const int argc = arguments().immediate(); 928 const int argc = arguments().immediate();
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 } 1036 }
1028 1037
1029 // Handle call cache miss. 1038 // Handle call cache miss.
1030 __ bind(&miss); 1039 __ bind(&miss);
1031 if (depth != kInvalidProtoDepth) { 1040 if (depth != kInvalidProtoDepth) {
1032 FreeSpaceForFastApiCall(masm(), rax); 1041 FreeSpaceForFastApiCall(masm(), rax);
1033 } 1042 }
1034 1043
1035 // Handle call cache miss. 1044 // Handle call cache miss.
1036 __ bind(&miss_in_smi_check); 1045 __ bind(&miss_in_smi_check);
1037 Object* obj = GenerateMissBranch(); 1046 Object* obj;
1038 if (obj->IsFailure()) return obj; 1047 { MaybeObject* maybe_obj = GenerateMissBranch();
1048 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
1049 }
1039 1050
1040 // Return the generated code. 1051 // Return the generated code.
1041 return GetCode(function); 1052 return GetCode(function);
1042 } 1053 }
1043 1054
1044 1055
1045 Object* CallStubCompiler::CompileCallField(JSObject* object, 1056 MaybeObject* CallStubCompiler::CompileCallField(JSObject* object,
1046 JSObject* holder, 1057 JSObject* holder,
1047 int index, 1058 int index,
1048 String* name) { 1059 String* name) {
1049 // ----------- S t a t e ------------- 1060 // ----------- S t a t e -------------
1050 // rcx : function name 1061 // rcx : function name
1051 // rsp[0] : return address 1062 // rsp[0] : return address
1052 // rsp[8] : argument argc 1063 // rsp[8] : argument argc
1053 // rsp[16] : argument argc - 1 1064 // rsp[16] : argument argc - 1
1054 // ... 1065 // ...
1055 // rsp[argc * 8] : argument 1 1066 // rsp[argc * 8] : argument 1
1056 // rsp[(argc + 1) * 8] : argument 0 = receiver 1067 // rsp[(argc + 1) * 8] : argument 0 = receiver
1057 // ----------------------------------- 1068 // -----------------------------------
1058 Label miss; 1069 Label miss;
(...skipping 23 matching lines...) Expand all
1082 if (object->IsGlobalObject()) { 1093 if (object->IsGlobalObject()) {
1083 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); 1094 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset));
1084 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); 1095 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx);
1085 } 1096 }
1086 1097
1087 // Invoke the function. 1098 // Invoke the function.
1088 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION); 1099 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION);
1089 1100
1090 // Handle call cache miss. 1101 // Handle call cache miss.
1091 __ bind(&miss); 1102 __ bind(&miss);
1092 Object* obj = GenerateMissBranch(); 1103 Object* obj;
1093 if (obj->IsFailure()) return obj; 1104 { MaybeObject* maybe_obj = GenerateMissBranch();
1105 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
1106 }
1094 1107
1095 // Return the generated code. 1108 // Return the generated code.
1096 return GetCode(FIELD, name); 1109 return GetCode(FIELD, name);
1097 } 1110 }
1098 1111
1099 1112
1100 Object* CallStubCompiler::CompileArrayPushCall(Object* object, 1113 MaybeObject* CallStubCompiler::CompileArrayPushCall(Object* object,
1101 JSObject* holder, 1114 JSObject* holder,
1102 JSGlobalPropertyCell* cell, 1115 JSGlobalPropertyCell* cell,
1103 JSFunction* function, 1116 JSFunction* function,
1104 String* name) { 1117 String* name) {
1105 // ----------- S t a t e ------------- 1118 // ----------- S t a t e -------------
1106 // -- rcx : name 1119 // -- rcx : name
1107 // -- rsp[0] : return address 1120 // -- rsp[0] : return address
1108 // -- rsp[(argc - n) * 8] : arg[n] (zero-based) 1121 // -- rsp[(argc - n) * 8] : arg[n] (zero-based)
1109 // -- ... 1122 // -- ...
1110 // -- rsp[(argc + 1) * 8] : receiver 1123 // -- rsp[(argc + 1) * 8] : receiver
1111 // ----------------------------------- 1124 // -----------------------------------
1112 1125
1113 // If object is not an array, bail out to regular call. 1126 // If object is not an array, bail out to regular call.
1114 if (!object->IsJSArray() || cell != NULL) return Heap::undefined_value(); 1127 if (!object->IsJSArray() || cell != NULL) return Heap::undefined_value();
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 __ bind(&with_write_barrier); 1197 __ bind(&with_write_barrier);
1185 1198
1186 __ InNewSpace(rbx, rcx, equal, &exit); 1199 __ InNewSpace(rbx, rcx, equal, &exit);
1187 1200
1188 RecordWriteStub stub(rbx, rdx, rcx); 1201 RecordWriteStub stub(rbx, rdx, rcx);
1189 __ CallStub(&stub); 1202 __ CallStub(&stub);
1190 1203
1191 __ ret((argc + 1) * kPointerSize); 1204 __ ret((argc + 1) * kPointerSize);
1192 1205
1193 __ bind(&attempt_to_grow_elements); 1206 __ bind(&attempt_to_grow_elements);
1207 if (!FLAG_inline_new) {
1208 __ jmp(&call_builtin);
1209 }
1210
1194 ExternalReference new_space_allocation_top = 1211 ExternalReference new_space_allocation_top =
1195 ExternalReference::new_space_allocation_top_address(); 1212 ExternalReference::new_space_allocation_top_address();
1196 ExternalReference new_space_allocation_limit = 1213 ExternalReference new_space_allocation_limit =
1197 ExternalReference::new_space_allocation_limit_address(); 1214 ExternalReference::new_space_allocation_limit_address();
1198 1215
1199 const int kAllocationDelta = 4; 1216 const int kAllocationDelta = 4;
1200 // Load top. 1217 // Load top.
1201 __ movq(rcx, new_space_allocation_top); 1218 __ movq(rcx, new_space_allocation_top);
1202 __ movq(rcx, Operand(rcx, 0)); 1219 __ movq(rcx, Operand(rcx, 0));
1203 1220
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 __ ret((argc + 1) * kPointerSize); 1257 __ ret((argc + 1) * kPointerSize);
1241 } 1258 }
1242 1259
1243 __ bind(&call_builtin); 1260 __ bind(&call_builtin);
1244 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush), 1261 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush),
1245 argc + 1, 1262 argc + 1,
1246 1); 1263 1);
1247 } 1264 }
1248 1265
1249 __ bind(&miss); 1266 __ bind(&miss);
1250 Object* obj = GenerateMissBranch(); 1267 Object* obj;
1251 if (obj->IsFailure()) return obj; 1268 { MaybeObject* maybe_obj = GenerateMissBranch();
1269 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
1270 }
1252 1271
1253 // Return the generated code. 1272 // Return the generated code.
1254 return GetCode(function); 1273 return GetCode(function);
1255 } 1274 }
1256 1275
1257 1276
1258 Object* CallStubCompiler::CompileArrayPopCall(Object* object, 1277 MaybeObject* CallStubCompiler::CompileArrayPopCall(Object* object,
1259 JSObject* holder, 1278 JSObject* holder,
1260 JSGlobalPropertyCell* cell, 1279 JSGlobalPropertyCell* cell,
1261 JSFunction* function, 1280 JSFunction* function,
1262 String* name) { 1281 String* name) {
1263 // ----------- S t a t e ------------- 1282 // ----------- S t a t e -------------
1264 // -- rcx : name 1283 // -- rcx : name
1265 // -- rsp[0] : return address 1284 // -- rsp[0] : return address
1266 // -- rsp[(argc - n) * 8] : arg[n] (zero-based) 1285 // -- rsp[(argc - n) * 8] : arg[n] (zero-based)
1267 // -- ... 1286 // -- ...
1268 // -- rsp[(argc + 1) * 8] : receiver 1287 // -- rsp[(argc + 1) * 8] : receiver
1269 // ----------------------------------- 1288 // -----------------------------------
1270 1289
1271 // If object is not an array, bail out to regular call. 1290 // If object is not an array, bail out to regular call.
1272 if (!object->IsJSArray() || cell != NULL) return Heap::undefined_value(); 1291 if (!object->IsJSArray() || cell != NULL) return Heap::undefined_value();
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1322 __ bind(&return_undefined); 1341 __ bind(&return_undefined);
1323 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); 1342 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex);
1324 __ ret((argc + 1) * kPointerSize); 1343 __ ret((argc + 1) * kPointerSize);
1325 1344
1326 __ bind(&call_builtin); 1345 __ bind(&call_builtin);
1327 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop), 1346 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop),
1328 argc + 1, 1347 argc + 1,
1329 1); 1348 1);
1330 1349
1331 __ bind(&miss); 1350 __ bind(&miss);
1332 Object* obj = GenerateMissBranch(); 1351 Object* obj;
1333 if (obj->IsFailure()) return obj; 1352 { MaybeObject* maybe_obj = GenerateMissBranch();
1353 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
1354 }
1334 1355
1335 // Return the generated code. 1356 // Return the generated code.
1336 return GetCode(function); 1357 return GetCode(function);
1337 } 1358 }
1338 1359
1339 1360
1340 Object* CallStubCompiler::CompileStringCharAtCall(Object* object, 1361 MaybeObject* CallStubCompiler::CompileStringCharAtCall(
1341 JSObject* holder, 1362 Object* object,
1342 JSGlobalPropertyCell* cell, 1363 JSObject* holder,
1343 JSFunction* function, 1364 JSGlobalPropertyCell* cell,
1344 String* name) { 1365 JSFunction* function,
1366 String* name) {
1345 // ----------- S t a t e ------------- 1367 // ----------- S t a t e -------------
1346 // -- rcx : function name 1368 // -- rcx : function name
1347 // -- rsp[0] : return address 1369 // -- rsp[0] : return address
1348 // -- rsp[(argc - n) * 8] : arg[n] (zero-based) 1370 // -- rsp[(argc - n) * 8] : arg[n] (zero-based)
1349 // -- ... 1371 // -- ...
1350 // -- rsp[(argc + 1) * 8] : receiver 1372 // -- rsp[(argc + 1) * 8] : receiver
1351 // ----------------------------------- 1373 // -----------------------------------
1352 1374
1353 // If object is not a string, bail out to regular call. 1375 // If object is not a string, bail out to regular call.
1354 if (!object->IsString() || cell != NULL) return Heap::undefined_value(); 1376 if (!object->IsString() || cell != NULL) return Heap::undefined_value();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1394 __ ret((argc + 1) * kPointerSize); 1416 __ ret((argc + 1) * kPointerSize);
1395 1417
1396 ICRuntimeCallHelper call_helper; 1418 ICRuntimeCallHelper call_helper;
1397 char_at_generator.GenerateSlow(masm(), call_helper); 1419 char_at_generator.GenerateSlow(masm(), call_helper);
1398 1420
1399 __ bind(&index_out_of_range); 1421 __ bind(&index_out_of_range);
1400 __ LoadRoot(rax, Heap::kEmptyStringRootIndex); 1422 __ LoadRoot(rax, Heap::kEmptyStringRootIndex);
1401 __ ret((argc + 1) * kPointerSize); 1423 __ ret((argc + 1) * kPointerSize);
1402 1424
1403 __ bind(&miss); 1425 __ bind(&miss);
1404 Object* obj = GenerateMissBranch(); 1426 Object* obj;
1405 if (obj->IsFailure()) return obj; 1427 { MaybeObject* maybe_obj = GenerateMissBranch();
1428 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
1429 }
1406 1430
1407 // Return the generated code. 1431 // Return the generated code.
1408 return GetCode(function); 1432 return GetCode(function);
1409 } 1433 }
1410 1434
1411 1435
1412 Object* CallStubCompiler::CompileStringCharCodeAtCall( 1436 MaybeObject* CallStubCompiler::CompileStringCharCodeAtCall(
1413 Object* object, 1437 Object* object,
1414 JSObject* holder, 1438 JSObject* holder,
1415 JSGlobalPropertyCell* cell, 1439 JSGlobalPropertyCell* cell,
1416 JSFunction* function, 1440 JSFunction* function,
1417 String* name) { 1441 String* name) {
1418 // ----------- S t a t e ------------- 1442 // ----------- S t a t e -------------
1419 // -- rcx : function name 1443 // -- rcx : function name
1420 // -- rsp[0] : return address 1444 // -- rsp[0] : return address
1421 // -- rsp[(argc - n) * 8] : arg[n] (zero-based) 1445 // -- rsp[(argc - n) * 8] : arg[n] (zero-based)
1422 // -- ... 1446 // -- ...
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1464 __ ret((argc + 1) * kPointerSize); 1488 __ ret((argc + 1) * kPointerSize);
1465 1489
1466 ICRuntimeCallHelper call_helper; 1490 ICRuntimeCallHelper call_helper;
1467 char_code_at_generator.GenerateSlow(masm(), call_helper); 1491 char_code_at_generator.GenerateSlow(masm(), call_helper);
1468 1492
1469 __ bind(&index_out_of_range); 1493 __ bind(&index_out_of_range);
1470 __ LoadRoot(rax, Heap::kNanValueRootIndex); 1494 __ LoadRoot(rax, Heap::kNanValueRootIndex);
1471 __ ret((argc + 1) * kPointerSize); 1495 __ ret((argc + 1) * kPointerSize);
1472 1496
1473 __ bind(&miss); 1497 __ bind(&miss);
1474 Object* obj = GenerateMissBranch(); 1498 Object* obj;
1475 if (obj->IsFailure()) return obj; 1499 { MaybeObject* maybe_obj = GenerateMissBranch();
1500 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
1501 }
1476 1502
1477 // Return the generated code. 1503 // Return the generated code.
1478 return GetCode(function); 1504 return GetCode(function);
1479 } 1505 }
1480 1506
1481 1507
1482 Object* CallStubCompiler::CompileStringFromCharCodeCall( 1508 MaybeObject* CallStubCompiler::CompileStringFromCharCodeCall(
1483 Object* object, 1509 Object* object,
1484 JSObject* holder, 1510 JSObject* holder,
1485 JSGlobalPropertyCell* cell, 1511 JSGlobalPropertyCell* cell,
1486 JSFunction* function, 1512 JSFunction* function,
1487 String* name) { 1513 String* name) {
1488 // ----------- S t a t e ------------- 1514 // ----------- S t a t e -------------
1489 // -- rcx : function name 1515 // -- rcx : function name
1490 // -- rsp[0] : return address 1516 // -- rsp[0] : return address
1491 // -- rsp[(argc - n) * 8] : arg[n] (zero-based) 1517 // -- rsp[(argc - n) * 8] : arg[n] (zero-based)
1492 // -- ... 1518 // -- ...
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1533 ICRuntimeCallHelper call_helper; 1559 ICRuntimeCallHelper call_helper;
1534 char_from_code_generator.GenerateSlow(masm(), call_helper); 1560 char_from_code_generator.GenerateSlow(masm(), call_helper);
1535 1561
1536 // Tail call the full function. We do not have to patch the receiver 1562 // Tail call the full function. We do not have to patch the receiver
1537 // because the function makes no use of it. 1563 // because the function makes no use of it.
1538 __ bind(&slow); 1564 __ bind(&slow);
1539 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); 1565 __ InvokeFunction(function, arguments(), JUMP_FUNCTION);
1540 1566
1541 __ bind(&miss); 1567 __ bind(&miss);
1542 // rcx: function name. 1568 // rcx: function name.
1543 Object* obj = GenerateMissBranch(); 1569 Object* obj;
1544 if (obj->IsFailure()) return obj; 1570 { MaybeObject* maybe_obj = GenerateMissBranch();
1571 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
1572 }
1545 1573
1546 // Return the generated code. 1574 // Return the generated code.
1547 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name); 1575 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name);
1548 } 1576 }
1549 1577
1550 1578
1551 Object* CallStubCompiler::CompileMathFloorCall(Object* object, 1579 MaybeObject* CallStubCompiler::CompileMathFloorCall(Object* object,
1552 JSObject* holder, 1580 JSObject* holder,
1553 JSGlobalPropertyCell* cell, 1581 JSGlobalPropertyCell* cell,
1554 JSFunction* function, 1582 JSFunction* function,
1555 String* name) { 1583 String* name) {
1556 // TODO(872): implement this. 1584 // TODO(872): implement this.
1557 return Heap::undefined_value(); 1585 return Heap::undefined_value();
1558 } 1586 }
1559 1587
1560 1588
1561 Object* CallStubCompiler::CompileMathAbsCall(Object* object, 1589 MaybeObject* CallStubCompiler::CompileMathAbsCall(Object* object,
1562 JSObject* holder, 1590 JSObject* holder,
1563 JSGlobalPropertyCell* cell, 1591 JSGlobalPropertyCell* cell,
1564 JSFunction* function, 1592 JSFunction* function,
1565 String* name) { 1593 String* name) {
1566 // ----------- S t a t e ------------- 1594 // ----------- S t a t e -------------
1567 // -- rcx : function name 1595 // -- rcx : function name
1568 // -- rsp[0] : return address 1596 // -- rsp[0] : return address
1569 // -- rsp[(argc - n) * 8] : arg[n] (zero-based) 1597 // -- rsp[(argc - n) * 8] : arg[n] (zero-based)
1570 // -- ... 1598 // -- ...
1571 // -- rsp[(argc + 1) * 8] : receiver 1599 // -- rsp[(argc + 1) * 8] : receiver
1572 // ----------------------------------- 1600 // -----------------------------------
1573 1601
1574 const int argc = arguments().immediate(); 1602 const int argc = arguments().immediate();
1575 1603
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1646 __ movq(FieldOperand(rax, HeapNumber::kValueOffset), rbx); 1674 __ movq(FieldOperand(rax, HeapNumber::kValueOffset), rbx);
1647 __ ret(2 * kPointerSize); 1675 __ ret(2 * kPointerSize);
1648 1676
1649 // Tail call the full function. We do not have to patch the receiver 1677 // Tail call the full function. We do not have to patch the receiver
1650 // because the function makes no use of it. 1678 // because the function makes no use of it.
1651 __ bind(&slow); 1679 __ bind(&slow);
1652 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); 1680 __ InvokeFunction(function, arguments(), JUMP_FUNCTION);
1653 1681
1654 __ bind(&miss); 1682 __ bind(&miss);
1655 // rcx: function name. 1683 // rcx: function name.
1656 Object* obj = GenerateMissBranch(); 1684 Object* obj;
1657 if (obj->IsFailure()) return obj; 1685 { MaybeObject* maybe_obj = GenerateMissBranch();
1686 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
1687 }
1658 1688
1659 // Return the generated code. 1689 // Return the generated code.
1660 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name); 1690 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name);
1661 } 1691 }
1662 1692
1663 1693
1664 Object* CallStubCompiler::CompileCallInterceptor(JSObject* object, 1694 MaybeObject* CallStubCompiler::CompileCallInterceptor(JSObject* object,
1665 JSObject* holder, 1695 JSObject* holder,
1666 String* name) { 1696 String* name) {
1667 // ----------- S t a t e ------------- 1697 // ----------- S t a t e -------------
1668 // rcx : function name 1698 // rcx : function name
1669 // rsp[0] : return address 1699 // rsp[0] : return address
1670 // rsp[8] : argument argc 1700 // rsp[8] : argument argc
1671 // rsp[16] : argument argc - 1 1701 // rsp[16] : argument argc - 1
1672 // ... 1702 // ...
1673 // rsp[argc * 8] : argument 1 1703 // rsp[argc * 8] : argument 1
1674 // rsp[(argc + 1) * 8] : argument 0 = receiver 1704 // rsp[(argc + 1) * 8] : argument 0 = receiver
1675 // ----------------------------------- 1705 // -----------------------------------
1676 Label miss; 1706 Label miss;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1712 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); 1742 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset));
1713 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); 1743 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx);
1714 } 1744 }
1715 1745
1716 // Invoke the function. 1746 // Invoke the function.
1717 __ movq(rdi, rax); 1747 __ movq(rdi, rax);
1718 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION); 1748 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION);
1719 1749
1720 // Handle load cache miss. 1750 // Handle load cache miss.
1721 __ bind(&miss); 1751 __ bind(&miss);
1722 Object* obj = GenerateMissBranch(); 1752 Object* obj;
1723 if (obj->IsFailure()) return obj; 1753 { MaybeObject* maybe_obj = GenerateMissBranch();
1754 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
1755 }
1724 1756
1725 // Return the generated code. 1757 // Return the generated code.
1726 return GetCode(INTERCEPTOR, name); 1758 return GetCode(INTERCEPTOR, name);
1727 } 1759 }
1728 1760
1729 1761
1730 Object* CallStubCompiler::CompileCallGlobal(JSObject* object, 1762 MaybeObject* CallStubCompiler::CompileCallGlobal(JSObject* object,
1731 GlobalObject* holder, 1763 GlobalObject* holder,
1732 JSGlobalPropertyCell* cell, 1764 JSGlobalPropertyCell* cell,
1733 JSFunction* function, 1765 JSFunction* function,
1734 String* name) { 1766 String* name) {
1735 // ----------- S t a t e ------------- 1767 // ----------- S t a t e -------------
1736 // rcx : function name 1768 // rcx : function name
1737 // rsp[0] : return address 1769 // rsp[0] : return address
1738 // rsp[8] : argument argc 1770 // rsp[8] : argument argc
1739 // rsp[16] : argument argc - 1 1771 // rsp[16] : argument argc - 1
1740 // ... 1772 // ...
1741 // rsp[argc * 8] : argument 1 1773 // rsp[argc * 8] : argument 1
1742 // rsp[(argc + 1) * 8] : argument 0 = receiver 1774 // rsp[(argc + 1) * 8] : argument 0 = receiver
1743 // ----------------------------------- 1775 // -----------------------------------
1744 1776
1745 SharedFunctionInfo* function_info = function->shared(); 1777 SharedFunctionInfo* function_info = function->shared();
1746 if (function_info->HasCustomCallGenerator()) { 1778 if (function_info->HasCustomCallGenerator()) {
1747 const int id = function_info->custom_call_generator_id(); 1779 const int id = function_info->custom_call_generator_id();
1748 Object* result = CompileCustomCall( 1780 MaybeObject* maybe_result = CompileCustomCall(
1749 id, object, holder, cell, function, name); 1781 id, object, holder, cell, function, name);
1782 Object* result;
1783 if (!maybe_result->ToObject(&result)) return maybe_result;
1750 // undefined means bail out to regular compiler. 1784 // undefined means bail out to regular compiler.
1751 if (!result->IsUndefined()) return result; 1785 if (!result->IsUndefined()) return result;
1752 } 1786 }
1753 1787
1754 Label miss; 1788 Label miss;
1755 1789
1756 GenerateNameCheck(name, &miss); 1790 GenerateNameCheck(name, &miss);
1757 1791
1758 // Get the number of arguments. 1792 // Get the number of arguments.
1759 const int argc = arguments().immediate(); 1793 const int argc = arguments().immediate();
(...skipping 15 matching lines...) Expand all
1775 __ IncrementCounter(&Counters::call_global_inline, 1); 1809 __ IncrementCounter(&Counters::call_global_inline, 1);
1776 ASSERT(function->is_compiled()); 1810 ASSERT(function->is_compiled());
1777 Handle<Code> code(function->code()); 1811 Handle<Code> code(function->code());
1778 ParameterCount expected(function->shared()->formal_parameter_count()); 1812 ParameterCount expected(function->shared()->formal_parameter_count());
1779 __ InvokeCode(code, expected, arguments(), 1813 __ InvokeCode(code, expected, arguments(),
1780 RelocInfo::CODE_TARGET, JUMP_FUNCTION); 1814 RelocInfo::CODE_TARGET, JUMP_FUNCTION);
1781 1815
1782 // Handle call cache miss. 1816 // Handle call cache miss.
1783 __ bind(&miss); 1817 __ bind(&miss);
1784 __ IncrementCounter(&Counters::call_global_inline_miss, 1); 1818 __ IncrementCounter(&Counters::call_global_inline_miss, 1);
1785 Object* obj = GenerateMissBranch(); 1819 Object* obj;
1786 if (obj->IsFailure()) return obj; 1820 { MaybeObject* maybe_obj = GenerateMissBranch();
1821 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
1822 }
1787 1823
1788 // Return the generated code. 1824 // Return the generated code.
1789 return GetCode(NORMAL, name); 1825 return GetCode(NORMAL, name);
1790 } 1826 }
1791 1827
1792 1828
1793 Object* LoadStubCompiler::CompileLoadCallback(String* name, 1829 MaybeObject* LoadStubCompiler::CompileLoadCallback(String* name,
1794 JSObject* object, 1830 JSObject* object,
1795 JSObject* holder, 1831 JSObject* holder,
1796 AccessorInfo* callback) { 1832 AccessorInfo* callback) {
1797 // ----------- S t a t e ------------- 1833 // ----------- S t a t e -------------
1798 // -- rax : receiver 1834 // -- rax : receiver
1799 // -- rcx : name 1835 // -- rcx : name
1800 // -- rsp[0] : return address 1836 // -- rsp[0] : return address
1801 // ----------------------------------- 1837 // -----------------------------------
1802 Label miss; 1838 Label miss;
1803 1839
1804 Failure* failure = Failure::InternalError(); 1840 Failure* failure = Failure::InternalError();
1805 bool success = GenerateLoadCallback(object, holder, rax, rcx, rbx, rdx, rdi, 1841 bool success = GenerateLoadCallback(object, holder, rax, rcx, rbx, rdx, rdi,
1806 callback, name, &miss, &failure); 1842 callback, name, &miss, &failure);
1807 if (!success) { 1843 if (!success) {
1808 miss.Unuse(); 1844 miss.Unuse();
1809 return failure; 1845 return failure;
1810 } 1846 }
1811 1847
1812 __ bind(&miss); 1848 __ bind(&miss);
1813 GenerateLoadMiss(masm(), Code::LOAD_IC); 1849 GenerateLoadMiss(masm(), Code::LOAD_IC);
1814 1850
1815 // Return the generated code. 1851 // Return the generated code.
1816 return GetCode(CALLBACKS, name); 1852 return GetCode(CALLBACKS, name);
1817 } 1853 }
1818 1854
1819 1855
1820 Object* LoadStubCompiler::CompileLoadConstant(JSObject* object, 1856 MaybeObject* LoadStubCompiler::CompileLoadConstant(JSObject* object,
1821 JSObject* holder, 1857 JSObject* holder,
1822 Object* value, 1858 Object* value,
1823 String* name) { 1859 String* name) {
1824 // ----------- S t a t e ------------- 1860 // ----------- S t a t e -------------
1825 // -- rax : receiver 1861 // -- rax : receiver
1826 // -- rcx : name 1862 // -- rcx : name
1827 // -- rsp[0] : return address 1863 // -- rsp[0] : return address
1828 // ----------------------------------- 1864 // -----------------------------------
1829 Label miss; 1865 Label miss;
1830 1866
1831 GenerateLoadConstant(object, holder, rax, rbx, rdx, rdi, value, name, &miss); 1867 GenerateLoadConstant(object, holder, rax, rbx, rdx, rdi, value, name, &miss);
1832 __ bind(&miss); 1868 __ bind(&miss);
1833 GenerateLoadMiss(masm(), Code::LOAD_IC); 1869 GenerateLoadMiss(masm(), Code::LOAD_IC);
1834 1870
1835 // Return the generated code. 1871 // Return the generated code.
1836 return GetCode(CONSTANT_FUNCTION, name); 1872 return GetCode(CONSTANT_FUNCTION, name);
1837 } 1873 }
1838 1874
1839 1875
1840 Object* LoadStubCompiler::CompileLoadNonexistent(String* name, 1876 MaybeObject* LoadStubCompiler::CompileLoadNonexistent(String* name,
1841 JSObject* object, 1877 JSObject* object,
1842 JSObject* last) { 1878 JSObject* last) {
1843 // ----------- S t a t e ------------- 1879 // ----------- S t a t e -------------
1844 // -- rax : receiver 1880 // -- rax : receiver
1845 // -- rcx : name 1881 // -- rcx : name
1846 // -- rsp[0] : return address 1882 // -- rsp[0] : return address
1847 // ----------------------------------- 1883 // -----------------------------------
1848 Label miss; 1884 Label miss;
1849 1885
1850 // Chech that receiver is not a smi. 1886 // Chech that receiver is not a smi.
1851 __ JumpIfSmi(rax, &miss); 1887 __ JumpIfSmi(rax, &miss);
1852 1888
1853 // Check the maps of the full prototype chain. Also check that 1889 // Check the maps of the full prototype chain. Also check that
1854 // global property cells up to (but not including) the last object 1890 // global property cells up to (but not including) the last object
1855 // in the prototype chain are empty. 1891 // in the prototype chain are empty.
1856 CheckPrototypes(object, rax, last, rbx, rdx, rdi, name, &miss); 1892 CheckPrototypes(object, rax, last, rbx, rdx, rdi, name, &miss);
1857 1893
1858 // If the last object in the prototype chain is a global object, 1894 // If the last object in the prototype chain is a global object,
1859 // check that the global property cell is empty. 1895 // check that the global property cell is empty.
1860 if (last->IsGlobalObject()) { 1896 if (last->IsGlobalObject()) {
1861 Object* cell = GenerateCheckPropertyCell(masm(), 1897 MaybeObject* cell = GenerateCheckPropertyCell(masm(),
1862 GlobalObject::cast(last), 1898 GlobalObject::cast(last),
1863 name, 1899 name,
1864 rdx, 1900 rdx,
1865 &miss); 1901 &miss);
1866 if (cell->IsFailure()) { 1902 if (cell->IsFailure()) {
1867 miss.Unuse(); 1903 miss.Unuse();
1868 return cell; 1904 return cell;
1869 } 1905 }
1870 } 1906 }
1871 1907
1872 // Return undefined if maps of the full prototype chain are still the 1908 // Return undefined if maps of the full prototype chain are still the
1873 // same and no global property with this name contains a value. 1909 // same and no global property with this name contains a value.
1874 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); 1910 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex);
1875 __ ret(0); 1911 __ ret(0);
1876 1912
1877 __ bind(&miss); 1913 __ bind(&miss);
1878 GenerateLoadMiss(masm(), Code::LOAD_IC); 1914 GenerateLoadMiss(masm(), Code::LOAD_IC);
1879 1915
1880 // Return the generated code. 1916 // Return the generated code.
1881 return GetCode(NONEXISTENT, Heap::empty_string()); 1917 return GetCode(NONEXISTENT, Heap::empty_string());
1882 } 1918 }
1883 1919
1884 1920
1885 Object* LoadStubCompiler::CompileLoadField(JSObject* object, 1921 MaybeObject* LoadStubCompiler::CompileLoadField(JSObject* object,
1886 JSObject* holder, 1922 JSObject* holder,
1887 int index, 1923 int index,
1888 String* name) { 1924 String* name) {
1889 // ----------- S t a t e ------------- 1925 // ----------- S t a t e -------------
1890 // -- rax : receiver 1926 // -- rax : receiver
1891 // -- rcx : name 1927 // -- rcx : name
1892 // -- rsp[0] : return address 1928 // -- rsp[0] : return address
1893 // ----------------------------------- 1929 // -----------------------------------
1894 Label miss; 1930 Label miss;
1895 1931
1896 GenerateLoadField(object, holder, rax, rbx, rdx, rdi, index, name, &miss); 1932 GenerateLoadField(object, holder, rax, rbx, rdx, rdi, index, name, &miss);
1897 __ bind(&miss); 1933 __ bind(&miss);
1898 GenerateLoadMiss(masm(), Code::LOAD_IC); 1934 GenerateLoadMiss(masm(), Code::LOAD_IC);
1899 1935
1900 // Return the generated code. 1936 // Return the generated code.
1901 return GetCode(FIELD, name); 1937 return GetCode(FIELD, name);
1902 } 1938 }
1903 1939
1904 1940
1905 Object* LoadStubCompiler::CompileLoadInterceptor(JSObject* receiver, 1941 MaybeObject* LoadStubCompiler::CompileLoadInterceptor(JSObject* receiver,
1906 JSObject* holder, 1942 JSObject* holder,
1907 String* name) { 1943 String* name) {
1908 // ----------- S t a t e ------------- 1944 // ----------- S t a t e -------------
1909 // -- rax : receiver 1945 // -- rax : receiver
1910 // -- rcx : name 1946 // -- rcx : name
1911 // -- rsp[0] : return address 1947 // -- rsp[0] : return address
1912 // ----------------------------------- 1948 // -----------------------------------
1913 Label miss; 1949 Label miss;
1914 1950
1915 LookupResult lookup; 1951 LookupResult lookup;
1916 LookupPostInterceptor(holder, name, &lookup); 1952 LookupPostInterceptor(holder, name, &lookup);
1917 1953
(...skipping 11 matching lines...) Expand all
1929 &miss); 1965 &miss);
1930 1966
1931 __ bind(&miss); 1967 __ bind(&miss);
1932 GenerateLoadMiss(masm(), Code::LOAD_IC); 1968 GenerateLoadMiss(masm(), Code::LOAD_IC);
1933 1969
1934 // Return the generated code. 1970 // Return the generated code.
1935 return GetCode(INTERCEPTOR, name); 1971 return GetCode(INTERCEPTOR, name);
1936 } 1972 }
1937 1973
1938 1974
1939 Object* LoadStubCompiler::CompileLoadGlobal(JSObject* object, 1975 MaybeObject* LoadStubCompiler::CompileLoadGlobal(JSObject* object,
1940 GlobalObject* holder, 1976 GlobalObject* holder,
1941 JSGlobalPropertyCell* cell, 1977 JSGlobalPropertyCell* cell,
1942 String* name, 1978 String* name,
1943 bool is_dont_delete) { 1979 bool is_dont_delete) {
1944 // ----------- S t a t e ------------- 1980 // ----------- S t a t e -------------
1945 // -- rax : receiver 1981 // -- rax : receiver
1946 // -- rcx : name 1982 // -- rcx : name
1947 // -- rsp[0] : return address 1983 // -- rsp[0] : return address
1948 // ----------------------------------- 1984 // -----------------------------------
1949 Label miss; 1985 Label miss;
1950 1986
1951 // If the object is the holder then we know that it's a global 1987 // If the object is the holder then we know that it's a global
1952 // object which can only happen for contextual loads. In this case, 1988 // object which can only happen for contextual loads. In this case,
1953 // the receiver cannot be a smi. 1989 // the receiver cannot be a smi.
(...skipping 23 matching lines...) Expand all
1977 2013
1978 __ bind(&miss); 2014 __ bind(&miss);
1979 __ IncrementCounter(&Counters::named_load_global_stub_miss, 1); 2015 __ IncrementCounter(&Counters::named_load_global_stub_miss, 1);
1980 GenerateLoadMiss(masm(), Code::LOAD_IC); 2016 GenerateLoadMiss(masm(), Code::LOAD_IC);
1981 2017
1982 // Return the generated code. 2018 // Return the generated code.
1983 return GetCode(NORMAL, name); 2019 return GetCode(NORMAL, name);
1984 } 2020 }
1985 2021
1986 2022
1987 Object* KeyedLoadStubCompiler::CompileLoadCallback(String* name, 2023 MaybeObject* KeyedLoadStubCompiler::CompileLoadCallback(
1988 JSObject* receiver, 2024 String* name,
1989 JSObject* holder, 2025 JSObject* receiver,
1990 AccessorInfo* callback) { 2026 JSObject* holder,
2027 AccessorInfo* callback) {
1991 // ----------- S t a t e ------------- 2028 // ----------- S t a t e -------------
1992 // -- rax : key 2029 // -- rax : key
1993 // -- rdx : receiver 2030 // -- rdx : receiver
1994 // -- rsp[0] : return address 2031 // -- rsp[0] : return address
1995 // ----------------------------------- 2032 // -----------------------------------
1996 Label miss; 2033 Label miss;
1997 2034
1998 __ IncrementCounter(&Counters::keyed_load_callback, 1); 2035 __ IncrementCounter(&Counters::keyed_load_callback, 1);
1999 2036
2000 // Check that the name has not changed. 2037 // Check that the name has not changed.
(...skipping 10 matching lines...) Expand all
2011 2048
2012 __ bind(&miss); 2049 __ bind(&miss);
2013 __ DecrementCounter(&Counters::keyed_load_callback, 1); 2050 __ DecrementCounter(&Counters::keyed_load_callback, 1);
2014 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); 2051 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
2015 2052
2016 // Return the generated code. 2053 // Return the generated code.
2017 return GetCode(CALLBACKS, name); 2054 return GetCode(CALLBACKS, name);
2018 } 2055 }
2019 2056
2020 2057
2021 Object* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) { 2058 MaybeObject* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) {
2022 // ----------- S t a t e ------------- 2059 // ----------- S t a t e -------------
2023 // -- rax : key 2060 // -- rax : key
2024 // -- rdx : receiver 2061 // -- rdx : receiver
2025 // -- rsp[0] : return address 2062 // -- rsp[0] : return address
2026 // ----------------------------------- 2063 // -----------------------------------
2027 Label miss; 2064 Label miss;
2028 2065
2029 __ IncrementCounter(&Counters::keyed_load_array_length, 1); 2066 __ IncrementCounter(&Counters::keyed_load_array_length, 1);
2030 2067
2031 // Check that the name has not changed. 2068 // Check that the name has not changed.
2032 __ Cmp(rax, Handle<String>(name)); 2069 __ Cmp(rax, Handle<String>(name));
2033 __ j(not_equal, &miss); 2070 __ j(not_equal, &miss);
2034 2071
2035 GenerateLoadArrayLength(masm(), rdx, rcx, &miss); 2072 GenerateLoadArrayLength(masm(), rdx, rcx, &miss);
2036 __ bind(&miss); 2073 __ bind(&miss);
2037 __ DecrementCounter(&Counters::keyed_load_array_length, 1); 2074 __ DecrementCounter(&Counters::keyed_load_array_length, 1);
2038 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); 2075 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
2039 2076
2040 // Return the generated code. 2077 // Return the generated code.
2041 return GetCode(CALLBACKS, name); 2078 return GetCode(CALLBACKS, name);
2042 } 2079 }
2043 2080
2044 2081
2045 Object* KeyedLoadStubCompiler::CompileLoadConstant(String* name, 2082 MaybeObject* KeyedLoadStubCompiler::CompileLoadConstant(String* name,
2046 JSObject* receiver, 2083 JSObject* receiver,
2047 JSObject* holder, 2084 JSObject* holder,
2048 Object* value) { 2085 Object* value) {
2049 // ----------- S t a t e ------------- 2086 // ----------- S t a t e -------------
2050 // -- rax : key 2087 // -- rax : key
2051 // -- rdx : receiver 2088 // -- rdx : receiver
2052 // -- rsp[0] : return address 2089 // -- rsp[0] : return address
2053 // ----------------------------------- 2090 // -----------------------------------
2054 Label miss; 2091 Label miss;
2055 2092
2056 __ IncrementCounter(&Counters::keyed_load_constant_function, 1); 2093 __ IncrementCounter(&Counters::keyed_load_constant_function, 1);
2057 2094
2058 // Check that the name has not changed. 2095 // Check that the name has not changed.
2059 __ Cmp(rax, Handle<String>(name)); 2096 __ Cmp(rax, Handle<String>(name));
2060 __ j(not_equal, &miss); 2097 __ j(not_equal, &miss);
2061 2098
2062 GenerateLoadConstant(receiver, holder, rdx, rbx, rcx, rdi, 2099 GenerateLoadConstant(receiver, holder, rdx, rbx, rcx, rdi,
2063 value, name, &miss); 2100 value, name, &miss);
2064 __ bind(&miss); 2101 __ bind(&miss);
2065 __ DecrementCounter(&Counters::keyed_load_constant_function, 1); 2102 __ DecrementCounter(&Counters::keyed_load_constant_function, 1);
2066 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); 2103 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
2067 2104
2068 // Return the generated code. 2105 // Return the generated code.
2069 return GetCode(CONSTANT_FUNCTION, name); 2106 return GetCode(CONSTANT_FUNCTION, name);
2070 } 2107 }
2071 2108
2072 2109
2073 Object* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) { 2110 MaybeObject* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) {
2074 // ----------- S t a t e ------------- 2111 // ----------- S t a t e -------------
2075 // -- rax : key 2112 // -- rax : key
2076 // -- rdx : receiver 2113 // -- rdx : receiver
2077 // -- rsp[0] : return address 2114 // -- rsp[0] : return address
2078 // ----------------------------------- 2115 // -----------------------------------
2079 Label miss; 2116 Label miss;
2080 2117
2081 __ IncrementCounter(&Counters::keyed_load_function_prototype, 1); 2118 __ IncrementCounter(&Counters::keyed_load_function_prototype, 1);
2082 2119
2083 // Check that the name has not changed. 2120 // Check that the name has not changed.
2084 __ Cmp(rax, Handle<String>(name)); 2121 __ Cmp(rax, Handle<String>(name));
2085 __ j(not_equal, &miss); 2122 __ j(not_equal, &miss);
2086 2123
2087 GenerateLoadFunctionPrototype(masm(), rdx, rcx, rbx, &miss); 2124 GenerateLoadFunctionPrototype(masm(), rdx, rcx, rbx, &miss);
2088 __ bind(&miss); 2125 __ bind(&miss);
2089 __ DecrementCounter(&Counters::keyed_load_function_prototype, 1); 2126 __ DecrementCounter(&Counters::keyed_load_function_prototype, 1);
2090 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); 2127 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
2091 2128
2092 // Return the generated code. 2129 // Return the generated code.
2093 return GetCode(CALLBACKS, name); 2130 return GetCode(CALLBACKS, name);
2094 } 2131 }
2095 2132
2096 2133
2097 Object* KeyedLoadStubCompiler::CompileLoadInterceptor(JSObject* receiver, 2134 MaybeObject* KeyedLoadStubCompiler::CompileLoadInterceptor(JSObject* receiver,
2098 JSObject* holder, 2135 JSObject* holder,
2099 String* name) { 2136 String* name) {
2100 // ----------- S t a t e ------------- 2137 // ----------- S t a t e -------------
2101 // -- rax : key 2138 // -- rax : key
2102 // -- rdx : receiver 2139 // -- rdx : receiver
2103 // -- rsp[0] : return address 2140 // -- rsp[0] : return address
2104 // ----------------------------------- 2141 // -----------------------------------
2105 Label miss; 2142 Label miss;
2106 2143
2107 __ IncrementCounter(&Counters::keyed_load_interceptor, 1); 2144 __ IncrementCounter(&Counters::keyed_load_interceptor, 1);
2108 2145
2109 // Check that the name has not changed. 2146 // Check that the name has not changed.
(...skipping 14 matching lines...) Expand all
2124 &miss); 2161 &miss);
2125 __ bind(&miss); 2162 __ bind(&miss);
2126 __ DecrementCounter(&Counters::keyed_load_interceptor, 1); 2163 __ DecrementCounter(&Counters::keyed_load_interceptor, 1);
2127 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); 2164 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
2128 2165
2129 // Return the generated code. 2166 // Return the generated code.
2130 return GetCode(INTERCEPTOR, name); 2167 return GetCode(INTERCEPTOR, name);
2131 } 2168 }
2132 2169
2133 2170
2134 Object* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) { 2171 MaybeObject* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) {
2135 // ----------- S t a t e ------------- 2172 // ----------- S t a t e -------------
2136 // -- rax : key 2173 // -- rax : key
2137 // -- rdx : receiver 2174 // -- rdx : receiver
2138 // -- rsp[0] : return address 2175 // -- rsp[0] : return address
2139 // ----------------------------------- 2176 // -----------------------------------
2140 Label miss; 2177 Label miss;
2141 2178
2142 __ IncrementCounter(&Counters::keyed_load_string_length, 1); 2179 __ IncrementCounter(&Counters::keyed_load_string_length, 1);
2143 2180
2144 // Check that the name has not changed. 2181 // Check that the name has not changed.
2145 __ Cmp(rax, Handle<String>(name)); 2182 __ Cmp(rax, Handle<String>(name));
2146 __ j(not_equal, &miss); 2183 __ j(not_equal, &miss);
2147 2184
2148 GenerateLoadStringLength(masm(), rdx, rcx, rbx, &miss); 2185 GenerateLoadStringLength(masm(), rdx, rcx, rbx, &miss);
2149 __ bind(&miss); 2186 __ bind(&miss);
2150 __ DecrementCounter(&Counters::keyed_load_string_length, 1); 2187 __ DecrementCounter(&Counters::keyed_load_string_length, 1);
2151 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); 2188 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
2152 2189
2153 // Return the generated code. 2190 // Return the generated code.
2154 return GetCode(CALLBACKS, name); 2191 return GetCode(CALLBACKS, name);
2155 } 2192 }
2156 2193
2157 2194
2158 Object* StoreStubCompiler::CompileStoreCallback(JSObject* object, 2195 MaybeObject* StoreStubCompiler::CompileStoreCallback(JSObject* object,
2159 AccessorInfo* callback, 2196 AccessorInfo* callback,
2160 String* name) { 2197 String* name) {
2161 // ----------- S t a t e ------------- 2198 // ----------- S t a t e -------------
2162 // -- rax : value 2199 // -- rax : value
2163 // -- rcx : name 2200 // -- rcx : name
2164 // -- rdx : receiver 2201 // -- rdx : receiver
2165 // -- rsp[0] : return address 2202 // -- rsp[0] : return address
2166 // ----------------------------------- 2203 // -----------------------------------
2167 Label miss; 2204 Label miss;
2168 2205
2169 // Check that the object isn't a smi. 2206 // Check that the object isn't a smi.
2170 __ JumpIfSmi(rdx, &miss); 2207 __ JumpIfSmi(rdx, &miss);
(...skipping 27 matching lines...) Expand all
2198 // Handle store cache miss. 2235 // Handle store cache miss.
2199 __ bind(&miss); 2236 __ bind(&miss);
2200 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); 2237 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss));
2201 __ Jump(ic, RelocInfo::CODE_TARGET); 2238 __ Jump(ic, RelocInfo::CODE_TARGET);
2202 2239
2203 // Return the generated code. 2240 // Return the generated code.
2204 return GetCode(CALLBACKS, name); 2241 return GetCode(CALLBACKS, name);
2205 } 2242 }
2206 2243
2207 2244
2208 Object* StoreStubCompiler::CompileStoreField(JSObject* object, 2245 MaybeObject* StoreStubCompiler::CompileStoreField(JSObject* object,
2209 int index, 2246 int index,
2210 Map* transition, 2247 Map* transition,
2211 String* name) { 2248 String* name) {
2212 // ----------- S t a t e ------------- 2249 // ----------- S t a t e -------------
2213 // -- rax : value 2250 // -- rax : value
2214 // -- rcx : name 2251 // -- rcx : name
2215 // -- rdx : receiver 2252 // -- rdx : receiver
2216 // -- rsp[0] : return address 2253 // -- rsp[0] : return address
2217 // ----------------------------------- 2254 // -----------------------------------
2218 Label miss; 2255 Label miss;
2219 2256
2220 // Generate store field code. Preserves receiver and name on jump to miss. 2257 // Generate store field code. Preserves receiver and name on jump to miss.
2221 GenerateStoreField(masm(), 2258 GenerateStoreField(masm(),
2222 object, 2259 object,
2223 index, 2260 index,
2224 transition, 2261 transition,
2225 rdx, rcx, rbx, 2262 rdx, rcx, rbx,
2226 &miss); 2263 &miss);
2227 2264
2228 // Handle store cache miss. 2265 // Handle store cache miss.
2229 __ bind(&miss); 2266 __ bind(&miss);
2230 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); 2267 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss));
2231 __ Jump(ic, RelocInfo::CODE_TARGET); 2268 __ Jump(ic, RelocInfo::CODE_TARGET);
2232 2269
2233 // Return the generated code. 2270 // Return the generated code.
2234 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name); 2271 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name);
2235 } 2272 }
2236 2273
2237 2274
2238 Object* StoreStubCompiler::CompileStoreInterceptor(JSObject* receiver, 2275 MaybeObject* StoreStubCompiler::CompileStoreInterceptor(JSObject* receiver,
2239 String* name) { 2276 String* name) {
2240 // ----------- S t a t e ------------- 2277 // ----------- S t a t e -------------
2241 // -- rax : value 2278 // -- rax : value
2242 // -- rcx : name 2279 // -- rcx : name
2243 // -- rdx : receiver 2280 // -- rdx : receiver
2244 // -- rsp[0] : return address 2281 // -- rsp[0] : return address
2245 // ----------------------------------- 2282 // -----------------------------------
2246 Label miss; 2283 Label miss;
2247 2284
2248 // Check that the object isn't a smi. 2285 // Check that the object isn't a smi.
2249 __ JumpIfSmi(rdx, &miss); 2286 __ JumpIfSmi(rdx, &miss);
(...skipping 26 matching lines...) Expand all
2276 // Handle store cache miss. 2313 // Handle store cache miss.
2277 __ bind(&miss); 2314 __ bind(&miss);
2278 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); 2315 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss));
2279 __ Jump(ic, RelocInfo::CODE_TARGET); 2316 __ Jump(ic, RelocInfo::CODE_TARGET);
2280 2317
2281 // Return the generated code. 2318 // Return the generated code.
2282 return GetCode(INTERCEPTOR, name); 2319 return GetCode(INTERCEPTOR, name);
2283 } 2320 }
2284 2321
2285 2322
2286 Object* StoreStubCompiler::CompileStoreGlobal(GlobalObject* object, 2323 MaybeObject* StoreStubCompiler::CompileStoreGlobal(GlobalObject* object,
2287 JSGlobalPropertyCell* cell, 2324 JSGlobalPropertyCell* cell,
2288 String* name) { 2325 String* name) {
2289 // ----------- S t a t e ------------- 2326 // ----------- S t a t e -------------
2290 // -- rax : value 2327 // -- rax : value
2291 // -- rcx : name 2328 // -- rcx : name
2292 // -- rdx : receiver 2329 // -- rdx : receiver
2293 // -- rsp[0] : return address 2330 // -- rsp[0] : return address
2294 // ----------------------------------- 2331 // -----------------------------------
2295 Label miss; 2332 Label miss;
2296 2333
2297 // Check that the map of the global has not changed. 2334 // Check that the map of the global has not changed.
2298 __ Cmp(FieldOperand(rdx, HeapObject::kMapOffset), 2335 __ Cmp(FieldOperand(rdx, HeapObject::kMapOffset),
(...skipping 12 matching lines...) Expand all
2311 __ bind(&miss); 2348 __ bind(&miss);
2312 __ IncrementCounter(&Counters::named_store_global_inline_miss, 1); 2349 __ IncrementCounter(&Counters::named_store_global_inline_miss, 1);
2313 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); 2350 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss));
2314 __ Jump(ic, RelocInfo::CODE_TARGET); 2351 __ Jump(ic, RelocInfo::CODE_TARGET);
2315 2352
2316 // Return the generated code. 2353 // Return the generated code.
2317 return GetCode(NORMAL, name); 2354 return GetCode(NORMAL, name);
2318 } 2355 }
2319 2356
2320 2357
2321 Object* KeyedLoadStubCompiler::CompileLoadField(String* name, 2358 MaybeObject* KeyedLoadStubCompiler::CompileLoadField(String* name,
2322 JSObject* receiver, 2359 JSObject* receiver,
2323 JSObject* holder, 2360 JSObject* holder,
2324 int index) { 2361 int index) {
2325 // ----------- S t a t e ------------- 2362 // ----------- S t a t e -------------
2326 // -- rax : key 2363 // -- rax : key
2327 // -- rdx : receiver 2364 // -- rdx : receiver
2328 // -- rsp[0] : return address 2365 // -- rsp[0] : return address
2329 // ----------------------------------- 2366 // -----------------------------------
2330 Label miss; 2367 Label miss;
2331 2368
2332 __ IncrementCounter(&Counters::keyed_load_field, 1); 2369 __ IncrementCounter(&Counters::keyed_load_field, 1);
2333 2370
2334 // Check that the name has not changed. 2371 // Check that the name has not changed.
2335 __ Cmp(rax, Handle<String>(name)); 2372 __ Cmp(rax, Handle<String>(name));
2336 __ j(not_equal, &miss); 2373 __ j(not_equal, &miss);
2337 2374
2338 GenerateLoadField(receiver, holder, rdx, rbx, rcx, rdi, index, name, &miss); 2375 GenerateLoadField(receiver, holder, rdx, rbx, rcx, rdi, index, name, &miss);
2339 2376
2340 __ bind(&miss); 2377 __ bind(&miss);
2341 __ DecrementCounter(&Counters::keyed_load_field, 1); 2378 __ DecrementCounter(&Counters::keyed_load_field, 1);
2342 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); 2379 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
2343 2380
2344 // Return the generated code. 2381 // Return the generated code.
2345 return GetCode(FIELD, name); 2382 return GetCode(FIELD, name);
2346 } 2383 }
2347 2384
2348 2385
2349 Object* KeyedStoreStubCompiler::CompileStoreField(JSObject* object, 2386 MaybeObject* KeyedStoreStubCompiler::CompileStoreField(JSObject* object,
2350 int index, 2387 int index,
2351 Map* transition, 2388 Map* transition,
2352 String* name) { 2389 String* name) {
2353 // ----------- S t a t e ------------- 2390 // ----------- S t a t e -------------
2354 // -- rax : value 2391 // -- rax : value
2355 // -- rcx : key 2392 // -- rcx : key
2356 // -- rdx : receiver 2393 // -- rdx : receiver
2357 // -- rsp[0] : return address 2394 // -- rsp[0] : return address
2358 // ----------------------------------- 2395 // -----------------------------------
2359 Label miss; 2396 Label miss;
2360 2397
2361 __ IncrementCounter(&Counters::keyed_store_field, 1); 2398 __ IncrementCounter(&Counters::keyed_store_field, 1);
2362 2399
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
2536 __ JumpIfSmi(receiver, miss); 2573 __ JumpIfSmi(receiver, miss);
2537 2574
2538 // Check that the maps haven't changed. 2575 // Check that the maps haven't changed.
2539 Register reg = 2576 Register reg =
2540 CheckPrototypes(object, receiver, holder, scratch1, 2577 CheckPrototypes(object, receiver, holder, scratch1,
2541 scratch2, scratch3, name, miss); 2578 scratch2, scratch3, name, miss);
2542 2579
2543 Handle<AccessorInfo> callback_handle(callback); 2580 Handle<AccessorInfo> callback_handle(callback);
2544 2581
2545 __ EnterInternalFrame(); 2582 __ EnterInternalFrame();
2546 __ PushHandleScope(scratch2);
2547 // Push the stack address where the list of arguments ends. 2583 // Push the stack address where the list of arguments ends.
2548 __ movq(scratch2, rsp); 2584 __ movq(scratch2, rsp);
2549 __ subq(scratch2, Immediate(2 * kPointerSize)); 2585 __ subq(scratch2, Immediate(2 * kPointerSize));
2550 __ push(scratch2); 2586 __ push(scratch2);
2551 __ push(receiver); // receiver 2587 __ push(receiver); // receiver
2552 __ push(reg); // holder 2588 __ push(reg); // holder
2553 if (Heap::InNewSpace(callback_handle->data())) { 2589 if (Heap::InNewSpace(callback_handle->data())) {
2554 __ Move(scratch2, callback_handle); 2590 __ Move(scratch2, callback_handle);
2555 __ push(FieldOperand(scratch2, AccessorInfo::kDataOffset)); // data 2591 __ push(FieldOperand(scratch2, AccessorInfo::kDataOffset)); // data
2556 } else { 2592 } else {
(...skipping 24 matching lines...) Expand all
2581 #ifdef _WIN64 2617 #ifdef _WIN64
2582 // We need to prepare a slot for result handle on stack and put 2618 // We need to prepare a slot for result handle on stack and put
2583 // a pointer to it into 1st arg register. 2619 // a pointer to it into 1st arg register.
2584 __ push(Immediate(0)); 2620 __ push(Immediate(0));
2585 __ movq(rcx, rsp); 2621 __ movq(rcx, rsp);
2586 #endif 2622 #endif
2587 // Emitting a stub call may try to allocate (if the code is not 2623 // Emitting a stub call may try to allocate (if the code is not
2588 // already generated). Do not allow the assembler to perform a 2624 // already generated). Do not allow the assembler to perform a
2589 // garbage collection but instead return the allocation failure 2625 // garbage collection but instead return the allocation failure
2590 // object. 2626 // object.
2591 Object* result = masm()->TryCallStub(&stub); 2627 MaybeObject* result = masm()->TryCallStub(&stub);
2592 if (result->IsFailure()) { 2628 if (result->IsFailure()) {
2593 *failure = Failure::cast(result); 2629 *failure = Failure::cast(result);
2594 return false; 2630 return false;
2595 } 2631 }
2596 #ifdef _WIN64 2632 #ifdef _WIN64
2597 // Discard allocated slot. 2633 // Discard allocated slot.
2598 __ addq(rsp, Immediate(kPointerSize)); 2634 __ addq(rsp, Immediate(kPointerSize));
2599 #endif 2635 #endif
2600
2601 // We need to avoid using rax since that now holds the result.
2602 Register tmp = scratch2.is(rax) ? reg : scratch2;
2603 // Emitting PopHandleScope may try to allocate. Do not allow the
2604 // assembler to perform a garbage collection but instead return a
2605 // failure object.
2606 result = masm()->TryPopHandleScope(rax, tmp);
2607 if (result->IsFailure()) {
2608 *failure = Failure::cast(result);
2609 return false;
2610 }
2611 __ LeaveInternalFrame(); 2636 __ LeaveInternalFrame();
2612 2637
2613 __ ret(0); 2638 __ ret(0);
2614 2639
2615 return true; 2640 return true;
2616 } 2641 }
2617 2642
2618 2643
2619 Register StubCompiler::CheckPrototypes(JSObject* object, 2644 Register StubCompiler::CheckPrototypes(JSObject* object,
2620 Register object_reg, 2645 Register object_reg,
(...skipping 27 matching lines...) Expand all
2648 2673
2649 // Only global objects and objects that do not require access 2674 // Only global objects and objects that do not require access
2650 // checks are allowed in stubs. 2675 // checks are allowed in stubs.
2651 ASSERT(current->IsJSGlobalProxy() || !current->IsAccessCheckNeeded()); 2676 ASSERT(current->IsJSGlobalProxy() || !current->IsAccessCheckNeeded());
2652 2677
2653 JSObject* prototype = JSObject::cast(current->GetPrototype()); 2678 JSObject* prototype = JSObject::cast(current->GetPrototype());
2654 if (!current->HasFastProperties() && 2679 if (!current->HasFastProperties() &&
2655 !current->IsJSGlobalObject() && 2680 !current->IsJSGlobalObject() &&
2656 !current->IsJSGlobalProxy()) { 2681 !current->IsJSGlobalProxy()) {
2657 if (!name->IsSymbol()) { 2682 if (!name->IsSymbol()) {
2658 Object* lookup_result = Heap::LookupSymbol(name); 2683 MaybeObject* lookup_result = Heap::LookupSymbol(name);
2659 if (lookup_result->IsFailure()) { 2684 if (lookup_result->IsFailure()) {
2660 set_failure(Failure::cast(lookup_result)); 2685 set_failure(Failure::cast(lookup_result));
2661 return reg; 2686 return reg;
2662 } else { 2687 } else {
2663 name = String::cast(lookup_result); 2688 name = String::cast(lookup_result->ToObjectUnchecked());
2664 } 2689 }
2665 } 2690 }
2666 ASSERT(current->property_dictionary()->FindEntry(name) == 2691 ASSERT(current->property_dictionary()->FindEntry(name) ==
2667 StringDictionary::kNotFound); 2692 StringDictionary::kNotFound);
2668 2693
2669 GenerateDictionaryNegativeLookup(masm(), 2694 GenerateDictionaryNegativeLookup(masm(),
2670 miss, 2695 miss,
2671 reg, 2696 reg,
2672 name, 2697 name,
2673 scratch1, 2698 scratch1,
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
2735 if (current->IsJSGlobalProxy()) { 2760 if (current->IsJSGlobalProxy()) {
2736 __ CheckAccessGlobalProxy(reg, scratch1, miss); 2761 __ CheckAccessGlobalProxy(reg, scratch1, miss);
2737 } 2762 }
2738 2763
2739 // If we've skipped any global objects, it's not enough to verify 2764 // If we've skipped any global objects, it's not enough to verify
2740 // that their maps haven't changed. We also need to check that the 2765 // that their maps haven't changed. We also need to check that the
2741 // property cell for the property is still empty. 2766 // property cell for the property is still empty.
2742 current = object; 2767 current = object;
2743 while (current != holder) { 2768 while (current != holder) {
2744 if (current->IsGlobalObject()) { 2769 if (current->IsGlobalObject()) {
2745 Object* cell = GenerateCheckPropertyCell(masm(), 2770 MaybeObject* cell = GenerateCheckPropertyCell(masm(),
2746 GlobalObject::cast(current), 2771 GlobalObject::cast(current),
2747 name, 2772 name,
2748 scratch1, 2773 scratch1,
2749 miss); 2774 miss);
2750 if (cell->IsFailure()) { 2775 if (cell->IsFailure()) {
2751 set_failure(Failure::cast(cell)); 2776 set_failure(Failure::cast(cell));
2752 return reg; 2777 return reg;
2753 } 2778 }
2754 } 2779 }
2755 current = JSObject::cast(current->GetPrototype()); 2780 current = JSObject::cast(current->GetPrototype());
2756 } 2781 }
2757 2782
2758 // Return the register containing the holder. 2783 // Return the register containing the holder.
2759 return reg; 2784 return reg;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
2801 scratch1, scratch2, scratch3, name, miss); 2826 scratch1, scratch2, scratch3, name, miss);
2802 2827
2803 // Return the constant value. 2828 // Return the constant value.
2804 __ Move(rax, Handle<Object>(value)); 2829 __ Move(rax, Handle<Object>(value));
2805 __ ret(0); 2830 __ ret(0);
2806 } 2831 }
2807 2832
2808 2833
2809 // Specialized stub for constructing objects from functions which only have only 2834 // Specialized stub for constructing objects from functions which only have only
2810 // simple assignments of the form this.x = ...; in their body. 2835 // simple assignments of the form this.x = ...; in their body.
2811 Object* ConstructStubCompiler::CompileConstructStub( 2836 MaybeObject* ConstructStubCompiler::CompileConstructStub(
2812 SharedFunctionInfo* shared) { 2837 SharedFunctionInfo* shared) {
2813 // ----------- S t a t e ------------- 2838 // ----------- S t a t e -------------
2814 // -- rax : argc 2839 // -- rax : argc
2815 // -- rdi : constructor 2840 // -- rdi : constructor
2816 // -- rsp[0] : return address 2841 // -- rsp[0] : return address
2817 // -- rsp[4] : last argument 2842 // -- rsp[4] : last argument
2818 // ----------------------------------- 2843 // -----------------------------------
2819 Label generic_stub_call; 2844 Label generic_stub_call;
2820 2845
2821 // Use r8 for holding undefined which is used in several places below. 2846 // Use r8 for holding undefined which is used in several places below.
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
2934 // Return the generated code. 2959 // Return the generated code.
2935 return GetCode(); 2960 return GetCode();
2936 } 2961 }
2937 2962
2938 2963
2939 #undef __ 2964 #undef __
2940 2965
2941 } } // namespace v8::internal 2966 } } // namespace v8::internal
2942 2967
2943 #endif // V8_TARGET_ARCH_X64 2968 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/simulator-x64.h ('k') | test/cctest/test-alloc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698