OLD | NEW |
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 Loading... |
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 Loading... |
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 Loading... |
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 Loading... |
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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1244 __ ret((argc + 1) * kPointerSize); | 1257 __ ret((argc + 1) * kPointerSize); |
1245 } | 1258 } |
1246 | 1259 |
1247 __ bind(&call_builtin); | 1260 __ bind(&call_builtin); |
1248 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush), | 1261 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush), |
1249 argc + 1, | 1262 argc + 1, |
1250 1); | 1263 1); |
1251 } | 1264 } |
1252 | 1265 |
1253 __ bind(&miss); | 1266 __ bind(&miss); |
1254 Object* obj = GenerateMissBranch(); | 1267 Object* obj; |
1255 if (obj->IsFailure()) return obj; | 1268 { MaybeObject* maybe_obj = GenerateMissBranch(); |
| 1269 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 1270 } |
1256 | 1271 |
1257 // Return the generated code. | 1272 // Return the generated code. |
1258 return GetCode(function); | 1273 return GetCode(function); |
1259 } | 1274 } |
1260 | 1275 |
1261 | 1276 |
1262 Object* CallStubCompiler::CompileArrayPopCall(Object* object, | 1277 MaybeObject* CallStubCompiler::CompileArrayPopCall(Object* object, |
1263 JSObject* holder, | 1278 JSObject* holder, |
1264 JSGlobalPropertyCell* cell, | 1279 JSGlobalPropertyCell* cell, |
1265 JSFunction* function, | 1280 JSFunction* function, |
1266 String* name) { | 1281 String* name) { |
1267 // ----------- S t a t e ------------- | 1282 // ----------- S t a t e ------------- |
1268 // -- rcx : name | 1283 // -- rcx : name |
1269 // -- rsp[0] : return address | 1284 // -- rsp[0] : return address |
1270 // -- rsp[(argc - n) * 8] : arg[n] (zero-based) | 1285 // -- rsp[(argc - n) * 8] : arg[n] (zero-based) |
1271 // -- ... | 1286 // -- ... |
1272 // -- rsp[(argc + 1) * 8] : receiver | 1287 // -- rsp[(argc + 1) * 8] : receiver |
1273 // ----------------------------------- | 1288 // ----------------------------------- |
1274 | 1289 |
1275 // If object is not an array, bail out to regular call. | 1290 // If object is not an array, bail out to regular call. |
1276 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 Loading... |
1326 __ bind(&return_undefined); | 1341 __ bind(&return_undefined); |
1327 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); | 1342 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); |
1328 __ ret((argc + 1) * kPointerSize); | 1343 __ ret((argc + 1) * kPointerSize); |
1329 | 1344 |
1330 __ bind(&call_builtin); | 1345 __ bind(&call_builtin); |
1331 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop), | 1346 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop), |
1332 argc + 1, | 1347 argc + 1, |
1333 1); | 1348 1); |
1334 | 1349 |
1335 __ bind(&miss); | 1350 __ bind(&miss); |
1336 Object* obj = GenerateMissBranch(); | 1351 Object* obj; |
1337 if (obj->IsFailure()) return obj; | 1352 { MaybeObject* maybe_obj = GenerateMissBranch(); |
| 1353 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 1354 } |
1338 | 1355 |
1339 // Return the generated code. | 1356 // Return the generated code. |
1340 return GetCode(function); | 1357 return GetCode(function); |
1341 } | 1358 } |
1342 | 1359 |
1343 | 1360 |
1344 Object* CallStubCompiler::CompileStringCharAtCall(Object* object, | 1361 MaybeObject* CallStubCompiler::CompileStringCharAtCall( |
1345 JSObject* holder, | 1362 Object* object, |
1346 JSGlobalPropertyCell* cell, | 1363 JSObject* holder, |
1347 JSFunction* function, | 1364 JSGlobalPropertyCell* cell, |
1348 String* name) { | 1365 JSFunction* function, |
| 1366 String* name) { |
1349 // ----------- S t a t e ------------- | 1367 // ----------- S t a t e ------------- |
1350 // -- rcx : function name | 1368 // -- rcx : function name |
1351 // -- rsp[0] : return address | 1369 // -- rsp[0] : return address |
1352 // -- rsp[(argc - n) * 8] : arg[n] (zero-based) | 1370 // -- rsp[(argc - n) * 8] : arg[n] (zero-based) |
1353 // -- ... | 1371 // -- ... |
1354 // -- rsp[(argc + 1) * 8] : receiver | 1372 // -- rsp[(argc + 1) * 8] : receiver |
1355 // ----------------------------------- | 1373 // ----------------------------------- |
1356 | 1374 |
1357 // If object is not a string, bail out to regular call. | 1375 // If object is not a string, bail out to regular call. |
1358 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 Loading... |
1398 __ ret((argc + 1) * kPointerSize); | 1416 __ ret((argc + 1) * kPointerSize); |
1399 | 1417 |
1400 ICRuntimeCallHelper call_helper; | 1418 ICRuntimeCallHelper call_helper; |
1401 char_at_generator.GenerateSlow(masm(), call_helper); | 1419 char_at_generator.GenerateSlow(masm(), call_helper); |
1402 | 1420 |
1403 __ bind(&index_out_of_range); | 1421 __ bind(&index_out_of_range); |
1404 __ LoadRoot(rax, Heap::kEmptyStringRootIndex); | 1422 __ LoadRoot(rax, Heap::kEmptyStringRootIndex); |
1405 __ ret((argc + 1) * kPointerSize); | 1423 __ ret((argc + 1) * kPointerSize); |
1406 | 1424 |
1407 __ bind(&miss); | 1425 __ bind(&miss); |
1408 Object* obj = GenerateMissBranch(); | 1426 Object* obj; |
1409 if (obj->IsFailure()) return obj; | 1427 { MaybeObject* maybe_obj = GenerateMissBranch(); |
| 1428 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 1429 } |
1410 | 1430 |
1411 // Return the generated code. | 1431 // Return the generated code. |
1412 return GetCode(function); | 1432 return GetCode(function); |
1413 } | 1433 } |
1414 | 1434 |
1415 | 1435 |
1416 Object* CallStubCompiler::CompileStringCharCodeAtCall( | 1436 MaybeObject* CallStubCompiler::CompileStringCharCodeAtCall( |
1417 Object* object, | 1437 Object* object, |
1418 JSObject* holder, | 1438 JSObject* holder, |
1419 JSGlobalPropertyCell* cell, | 1439 JSGlobalPropertyCell* cell, |
1420 JSFunction* function, | 1440 JSFunction* function, |
1421 String* name) { | 1441 String* name) { |
1422 // ----------- S t a t e ------------- | 1442 // ----------- S t a t e ------------- |
1423 // -- rcx : function name | 1443 // -- rcx : function name |
1424 // -- rsp[0] : return address | 1444 // -- rsp[0] : return address |
1425 // -- rsp[(argc - n) * 8] : arg[n] (zero-based) | 1445 // -- rsp[(argc - n) * 8] : arg[n] (zero-based) |
1426 // -- ... | 1446 // -- ... |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1468 __ ret((argc + 1) * kPointerSize); | 1488 __ ret((argc + 1) * kPointerSize); |
1469 | 1489 |
1470 ICRuntimeCallHelper call_helper; | 1490 ICRuntimeCallHelper call_helper; |
1471 char_code_at_generator.GenerateSlow(masm(), call_helper); | 1491 char_code_at_generator.GenerateSlow(masm(), call_helper); |
1472 | 1492 |
1473 __ bind(&index_out_of_range); | 1493 __ bind(&index_out_of_range); |
1474 __ LoadRoot(rax, Heap::kNanValueRootIndex); | 1494 __ LoadRoot(rax, Heap::kNanValueRootIndex); |
1475 __ ret((argc + 1) * kPointerSize); | 1495 __ ret((argc + 1) * kPointerSize); |
1476 | 1496 |
1477 __ bind(&miss); | 1497 __ bind(&miss); |
1478 Object* obj = GenerateMissBranch(); | 1498 Object* obj; |
1479 if (obj->IsFailure()) return obj; | 1499 { MaybeObject* maybe_obj = GenerateMissBranch(); |
| 1500 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 1501 } |
1480 | 1502 |
1481 // Return the generated code. | 1503 // Return the generated code. |
1482 return GetCode(function); | 1504 return GetCode(function); |
1483 } | 1505 } |
1484 | 1506 |
1485 | 1507 |
1486 Object* CallStubCompiler::CompileStringFromCharCodeCall( | 1508 MaybeObject* CallStubCompiler::CompileStringFromCharCodeCall( |
1487 Object* object, | 1509 Object* object, |
1488 JSObject* holder, | 1510 JSObject* holder, |
1489 JSGlobalPropertyCell* cell, | 1511 JSGlobalPropertyCell* cell, |
1490 JSFunction* function, | 1512 JSFunction* function, |
1491 String* name) { | 1513 String* name) { |
1492 // ----------- S t a t e ------------- | 1514 // ----------- S t a t e ------------- |
1493 // -- rcx : function name | 1515 // -- rcx : function name |
1494 // -- rsp[0] : return address | 1516 // -- rsp[0] : return address |
1495 // -- rsp[(argc - n) * 8] : arg[n] (zero-based) | 1517 // -- rsp[(argc - n) * 8] : arg[n] (zero-based) |
1496 // -- ... | 1518 // -- ... |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1537 ICRuntimeCallHelper call_helper; | 1559 ICRuntimeCallHelper call_helper; |
1538 char_from_code_generator.GenerateSlow(masm(), call_helper); | 1560 char_from_code_generator.GenerateSlow(masm(), call_helper); |
1539 | 1561 |
1540 // 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 |
1541 // because the function makes no use of it. | 1563 // because the function makes no use of it. |
1542 __ bind(&slow); | 1564 __ bind(&slow); |
1543 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); | 1565 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); |
1544 | 1566 |
1545 __ bind(&miss); | 1567 __ bind(&miss); |
1546 // rcx: function name. | 1568 // rcx: function name. |
1547 Object* obj = GenerateMissBranch(); | 1569 Object* obj; |
1548 if (obj->IsFailure()) return obj; | 1570 { MaybeObject* maybe_obj = GenerateMissBranch(); |
| 1571 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 1572 } |
1549 | 1573 |
1550 // Return the generated code. | 1574 // Return the generated code. |
1551 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name); | 1575 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name); |
1552 } | 1576 } |
1553 | 1577 |
1554 | 1578 |
1555 Object* CallStubCompiler::CompileMathFloorCall(Object* object, | 1579 MaybeObject* CallStubCompiler::CompileMathFloorCall(Object* object, |
1556 JSObject* holder, | 1580 JSObject* holder, |
1557 JSGlobalPropertyCell* cell, | 1581 JSGlobalPropertyCell* cell, |
1558 JSFunction* function, | 1582 JSFunction* function, |
1559 String* name) { | 1583 String* name) { |
1560 // TODO(872): implement this. | 1584 // TODO(872): implement this. |
1561 return Heap::undefined_value(); | 1585 return Heap::undefined_value(); |
1562 } | 1586 } |
1563 | 1587 |
1564 | 1588 |
1565 Object* CallStubCompiler::CompileMathAbsCall(Object* object, | 1589 MaybeObject* CallStubCompiler::CompileMathAbsCall(Object* object, |
1566 JSObject* holder, | 1590 JSObject* holder, |
1567 JSGlobalPropertyCell* cell, | 1591 JSGlobalPropertyCell* cell, |
1568 JSFunction* function, | 1592 JSFunction* function, |
1569 String* name) { | 1593 String* name) { |
1570 // ----------- S t a t e ------------- | 1594 // ----------- S t a t e ------------- |
1571 // -- rcx : function name | 1595 // -- rcx : function name |
1572 // -- rsp[0] : return address | 1596 // -- rsp[0] : return address |
1573 // -- rsp[(argc - n) * 8] : arg[n] (zero-based) | 1597 // -- rsp[(argc - n) * 8] : arg[n] (zero-based) |
1574 // -- ... | 1598 // -- ... |
1575 // -- rsp[(argc + 1) * 8] : receiver | 1599 // -- rsp[(argc + 1) * 8] : receiver |
1576 // ----------------------------------- | 1600 // ----------------------------------- |
1577 | 1601 |
1578 const int argc = arguments().immediate(); | 1602 const int argc = arguments().immediate(); |
1579 | 1603 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1650 __ movq(FieldOperand(rax, HeapNumber::kValueOffset), rbx); | 1674 __ movq(FieldOperand(rax, HeapNumber::kValueOffset), rbx); |
1651 __ ret(2 * kPointerSize); | 1675 __ ret(2 * kPointerSize); |
1652 | 1676 |
1653 // 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 |
1654 // because the function makes no use of it. | 1678 // because the function makes no use of it. |
1655 __ bind(&slow); | 1679 __ bind(&slow); |
1656 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); | 1680 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); |
1657 | 1681 |
1658 __ bind(&miss); | 1682 __ bind(&miss); |
1659 // rcx: function name. | 1683 // rcx: function name. |
1660 Object* obj = GenerateMissBranch(); | 1684 Object* obj; |
1661 if (obj->IsFailure()) return obj; | 1685 { MaybeObject* maybe_obj = GenerateMissBranch(); |
| 1686 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 1687 } |
1662 | 1688 |
1663 // Return the generated code. | 1689 // Return the generated code. |
1664 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name); | 1690 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name); |
1665 } | 1691 } |
1666 | 1692 |
1667 | 1693 |
1668 Object* CallStubCompiler::CompileCallInterceptor(JSObject* object, | 1694 MaybeObject* CallStubCompiler::CompileCallInterceptor(JSObject* object, |
1669 JSObject* holder, | 1695 JSObject* holder, |
1670 String* name) { | 1696 String* name) { |
1671 // ----------- S t a t e ------------- | 1697 // ----------- S t a t e ------------- |
1672 // rcx : function name | 1698 // rcx : function name |
1673 // rsp[0] : return address | 1699 // rsp[0] : return address |
1674 // rsp[8] : argument argc | 1700 // rsp[8] : argument argc |
1675 // rsp[16] : argument argc - 1 | 1701 // rsp[16] : argument argc - 1 |
1676 // ... | 1702 // ... |
1677 // rsp[argc * 8] : argument 1 | 1703 // rsp[argc * 8] : argument 1 |
1678 // rsp[(argc + 1) * 8] : argument 0 = receiver | 1704 // rsp[(argc + 1) * 8] : argument 0 = receiver |
1679 // ----------------------------------- | 1705 // ----------------------------------- |
1680 Label miss; | 1706 Label miss; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1716 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); | 1742 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); |
1717 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); | 1743 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); |
1718 } | 1744 } |
1719 | 1745 |
1720 // Invoke the function. | 1746 // Invoke the function. |
1721 __ movq(rdi, rax); | 1747 __ movq(rdi, rax); |
1722 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION); | 1748 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION); |
1723 | 1749 |
1724 // Handle load cache miss. | 1750 // Handle load cache miss. |
1725 __ bind(&miss); | 1751 __ bind(&miss); |
1726 Object* obj = GenerateMissBranch(); | 1752 Object* obj; |
1727 if (obj->IsFailure()) return obj; | 1753 { MaybeObject* maybe_obj = GenerateMissBranch(); |
| 1754 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 1755 } |
1728 | 1756 |
1729 // Return the generated code. | 1757 // Return the generated code. |
1730 return GetCode(INTERCEPTOR, name); | 1758 return GetCode(INTERCEPTOR, name); |
1731 } | 1759 } |
1732 | 1760 |
1733 | 1761 |
1734 Object* CallStubCompiler::CompileCallGlobal(JSObject* object, | 1762 MaybeObject* CallStubCompiler::CompileCallGlobal(JSObject* object, |
1735 GlobalObject* holder, | 1763 GlobalObject* holder, |
1736 JSGlobalPropertyCell* cell, | 1764 JSGlobalPropertyCell* cell, |
1737 JSFunction* function, | 1765 JSFunction* function, |
1738 String* name) { | 1766 String* name) { |
1739 // ----------- S t a t e ------------- | 1767 // ----------- S t a t e ------------- |
1740 // rcx : function name | 1768 // rcx : function name |
1741 // rsp[0] : return address | 1769 // rsp[0] : return address |
1742 // rsp[8] : argument argc | 1770 // rsp[8] : argument argc |
1743 // rsp[16] : argument argc - 1 | 1771 // rsp[16] : argument argc - 1 |
1744 // ... | 1772 // ... |
1745 // rsp[argc * 8] : argument 1 | 1773 // rsp[argc * 8] : argument 1 |
1746 // rsp[(argc + 1) * 8] : argument 0 = receiver | 1774 // rsp[(argc + 1) * 8] : argument 0 = receiver |
1747 // ----------------------------------- | 1775 // ----------------------------------- |
1748 | 1776 |
1749 SharedFunctionInfo* function_info = function->shared(); | 1777 SharedFunctionInfo* function_info = function->shared(); |
1750 if (function_info->HasCustomCallGenerator()) { | 1778 if (function_info->HasCustomCallGenerator()) { |
1751 const int id = function_info->custom_call_generator_id(); | 1779 const int id = function_info->custom_call_generator_id(); |
1752 Object* result = CompileCustomCall( | 1780 MaybeObject* maybe_result = CompileCustomCall( |
1753 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; |
1754 // undefined means bail out to regular compiler. | 1784 // undefined means bail out to regular compiler. |
1755 if (!result->IsUndefined()) return result; | 1785 if (!result->IsUndefined()) return result; |
1756 } | 1786 } |
1757 | 1787 |
1758 Label miss; | 1788 Label miss; |
1759 | 1789 |
1760 GenerateNameCheck(name, &miss); | 1790 GenerateNameCheck(name, &miss); |
1761 | 1791 |
1762 // Get the number of arguments. | 1792 // Get the number of arguments. |
1763 const int argc = arguments().immediate(); | 1793 const int argc = arguments().immediate(); |
(...skipping 15 matching lines...) Expand all Loading... |
1779 __ IncrementCounter(&Counters::call_global_inline, 1); | 1809 __ IncrementCounter(&Counters::call_global_inline, 1); |
1780 ASSERT(function->is_compiled()); | 1810 ASSERT(function->is_compiled()); |
1781 Handle<Code> code(function->code()); | 1811 Handle<Code> code(function->code()); |
1782 ParameterCount expected(function->shared()->formal_parameter_count()); | 1812 ParameterCount expected(function->shared()->formal_parameter_count()); |
1783 __ InvokeCode(code, expected, arguments(), | 1813 __ InvokeCode(code, expected, arguments(), |
1784 RelocInfo::CODE_TARGET, JUMP_FUNCTION); | 1814 RelocInfo::CODE_TARGET, JUMP_FUNCTION); |
1785 | 1815 |
1786 // Handle call cache miss. | 1816 // Handle call cache miss. |
1787 __ bind(&miss); | 1817 __ bind(&miss); |
1788 __ IncrementCounter(&Counters::call_global_inline_miss, 1); | 1818 __ IncrementCounter(&Counters::call_global_inline_miss, 1); |
1789 Object* obj = GenerateMissBranch(); | 1819 Object* obj; |
1790 if (obj->IsFailure()) return obj; | 1820 { MaybeObject* maybe_obj = GenerateMissBranch(); |
| 1821 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 1822 } |
1791 | 1823 |
1792 // Return the generated code. | 1824 // Return the generated code. |
1793 return GetCode(NORMAL, name); | 1825 return GetCode(NORMAL, name); |
1794 } | 1826 } |
1795 | 1827 |
1796 | 1828 |
1797 Object* LoadStubCompiler::CompileLoadCallback(String* name, | 1829 MaybeObject* LoadStubCompiler::CompileLoadCallback(String* name, |
1798 JSObject* object, | 1830 JSObject* object, |
1799 JSObject* holder, | 1831 JSObject* holder, |
1800 AccessorInfo* callback) { | 1832 AccessorInfo* callback) { |
1801 // ----------- S t a t e ------------- | 1833 // ----------- S t a t e ------------- |
1802 // -- rax : receiver | 1834 // -- rax : receiver |
1803 // -- rcx : name | 1835 // -- rcx : name |
1804 // -- rsp[0] : return address | 1836 // -- rsp[0] : return address |
1805 // ----------------------------------- | 1837 // ----------------------------------- |
1806 Label miss; | 1838 Label miss; |
1807 | 1839 |
1808 Failure* failure = Failure::InternalError(); | 1840 Failure* failure = Failure::InternalError(); |
1809 bool success = GenerateLoadCallback(object, holder, rax, rcx, rbx, rdx, rdi, | 1841 bool success = GenerateLoadCallback(object, holder, rax, rcx, rbx, rdx, rdi, |
1810 callback, name, &miss, &failure); | 1842 callback, name, &miss, &failure); |
1811 if (!success) { | 1843 if (!success) { |
1812 miss.Unuse(); | 1844 miss.Unuse(); |
1813 return failure; | 1845 return failure; |
1814 } | 1846 } |
1815 | 1847 |
1816 __ bind(&miss); | 1848 __ bind(&miss); |
1817 GenerateLoadMiss(masm(), Code::LOAD_IC); | 1849 GenerateLoadMiss(masm(), Code::LOAD_IC); |
1818 | 1850 |
1819 // Return the generated code. | 1851 // Return the generated code. |
1820 return GetCode(CALLBACKS, name); | 1852 return GetCode(CALLBACKS, name); |
1821 } | 1853 } |
1822 | 1854 |
1823 | 1855 |
1824 Object* LoadStubCompiler::CompileLoadConstant(JSObject* object, | 1856 MaybeObject* LoadStubCompiler::CompileLoadConstant(JSObject* object, |
1825 JSObject* holder, | 1857 JSObject* holder, |
1826 Object* value, | 1858 Object* value, |
1827 String* name) { | 1859 String* name) { |
1828 // ----------- S t a t e ------------- | 1860 // ----------- S t a t e ------------- |
1829 // -- rax : receiver | 1861 // -- rax : receiver |
1830 // -- rcx : name | 1862 // -- rcx : name |
1831 // -- rsp[0] : return address | 1863 // -- rsp[0] : return address |
1832 // ----------------------------------- | 1864 // ----------------------------------- |
1833 Label miss; | 1865 Label miss; |
1834 | 1866 |
1835 GenerateLoadConstant(object, holder, rax, rbx, rdx, rdi, value, name, &miss); | 1867 GenerateLoadConstant(object, holder, rax, rbx, rdx, rdi, value, name, &miss); |
1836 __ bind(&miss); | 1868 __ bind(&miss); |
1837 GenerateLoadMiss(masm(), Code::LOAD_IC); | 1869 GenerateLoadMiss(masm(), Code::LOAD_IC); |
1838 | 1870 |
1839 // Return the generated code. | 1871 // Return the generated code. |
1840 return GetCode(CONSTANT_FUNCTION, name); | 1872 return GetCode(CONSTANT_FUNCTION, name); |
1841 } | 1873 } |
1842 | 1874 |
1843 | 1875 |
1844 Object* LoadStubCompiler::CompileLoadNonexistent(String* name, | 1876 MaybeObject* LoadStubCompiler::CompileLoadNonexistent(String* name, |
1845 JSObject* object, | 1877 JSObject* object, |
1846 JSObject* last) { | 1878 JSObject* last) { |
1847 // ----------- S t a t e ------------- | 1879 // ----------- S t a t e ------------- |
1848 // -- rax : receiver | 1880 // -- rax : receiver |
1849 // -- rcx : name | 1881 // -- rcx : name |
1850 // -- rsp[0] : return address | 1882 // -- rsp[0] : return address |
1851 // ----------------------------------- | 1883 // ----------------------------------- |
1852 Label miss; | 1884 Label miss; |
1853 | 1885 |
1854 // Chech that receiver is not a smi. | 1886 // Chech that receiver is not a smi. |
1855 __ JumpIfSmi(rax, &miss); | 1887 __ JumpIfSmi(rax, &miss); |
1856 | 1888 |
1857 // Check the maps of the full prototype chain. Also check that | 1889 // Check the maps of the full prototype chain. Also check that |
1858 // global property cells up to (but not including) the last object | 1890 // global property cells up to (but not including) the last object |
1859 // in the prototype chain are empty. | 1891 // in the prototype chain are empty. |
1860 CheckPrototypes(object, rax, last, rbx, rdx, rdi, name, &miss); | 1892 CheckPrototypes(object, rax, last, rbx, rdx, rdi, name, &miss); |
1861 | 1893 |
1862 // 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, |
1863 // check that the global property cell is empty. | 1895 // check that the global property cell is empty. |
1864 if (last->IsGlobalObject()) { | 1896 if (last->IsGlobalObject()) { |
1865 Object* cell = GenerateCheckPropertyCell(masm(), | 1897 MaybeObject* cell = GenerateCheckPropertyCell(masm(), |
1866 GlobalObject::cast(last), | 1898 GlobalObject::cast(last), |
1867 name, | 1899 name, |
1868 rdx, | 1900 rdx, |
1869 &miss); | 1901 &miss); |
1870 if (cell->IsFailure()) { | 1902 if (cell->IsFailure()) { |
1871 miss.Unuse(); | 1903 miss.Unuse(); |
1872 return cell; | 1904 return cell; |
1873 } | 1905 } |
1874 } | 1906 } |
1875 | 1907 |
1876 // 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 |
1877 // same and no global property with this name contains a value. | 1909 // same and no global property with this name contains a value. |
1878 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); | 1910 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); |
1879 __ ret(0); | 1911 __ ret(0); |
1880 | 1912 |
1881 __ bind(&miss); | 1913 __ bind(&miss); |
1882 GenerateLoadMiss(masm(), Code::LOAD_IC); | 1914 GenerateLoadMiss(masm(), Code::LOAD_IC); |
1883 | 1915 |
1884 // Return the generated code. | 1916 // Return the generated code. |
1885 return GetCode(NONEXISTENT, Heap::empty_string()); | 1917 return GetCode(NONEXISTENT, Heap::empty_string()); |
1886 } | 1918 } |
1887 | 1919 |
1888 | 1920 |
1889 Object* LoadStubCompiler::CompileLoadField(JSObject* object, | 1921 MaybeObject* LoadStubCompiler::CompileLoadField(JSObject* object, |
1890 JSObject* holder, | 1922 JSObject* holder, |
1891 int index, | 1923 int index, |
1892 String* name) { | 1924 String* name) { |
1893 // ----------- S t a t e ------------- | 1925 // ----------- S t a t e ------------- |
1894 // -- rax : receiver | 1926 // -- rax : receiver |
1895 // -- rcx : name | 1927 // -- rcx : name |
1896 // -- rsp[0] : return address | 1928 // -- rsp[0] : return address |
1897 // ----------------------------------- | 1929 // ----------------------------------- |
1898 Label miss; | 1930 Label miss; |
1899 | 1931 |
1900 GenerateLoadField(object, holder, rax, rbx, rdx, rdi, index, name, &miss); | 1932 GenerateLoadField(object, holder, rax, rbx, rdx, rdi, index, name, &miss); |
1901 __ bind(&miss); | 1933 __ bind(&miss); |
1902 GenerateLoadMiss(masm(), Code::LOAD_IC); | 1934 GenerateLoadMiss(masm(), Code::LOAD_IC); |
1903 | 1935 |
1904 // Return the generated code. | 1936 // Return the generated code. |
1905 return GetCode(FIELD, name); | 1937 return GetCode(FIELD, name); |
1906 } | 1938 } |
1907 | 1939 |
1908 | 1940 |
1909 Object* LoadStubCompiler::CompileLoadInterceptor(JSObject* receiver, | 1941 MaybeObject* LoadStubCompiler::CompileLoadInterceptor(JSObject* receiver, |
1910 JSObject* holder, | 1942 JSObject* holder, |
1911 String* name) { | 1943 String* name) { |
1912 // ----------- S t a t e ------------- | 1944 // ----------- S t a t e ------------- |
1913 // -- rax : receiver | 1945 // -- rax : receiver |
1914 // -- rcx : name | 1946 // -- rcx : name |
1915 // -- rsp[0] : return address | 1947 // -- rsp[0] : return address |
1916 // ----------------------------------- | 1948 // ----------------------------------- |
1917 Label miss; | 1949 Label miss; |
1918 | 1950 |
1919 LookupResult lookup; | 1951 LookupResult lookup; |
1920 LookupPostInterceptor(holder, name, &lookup); | 1952 LookupPostInterceptor(holder, name, &lookup); |
1921 | 1953 |
(...skipping 11 matching lines...) Expand all Loading... |
1933 &miss); | 1965 &miss); |
1934 | 1966 |
1935 __ bind(&miss); | 1967 __ bind(&miss); |
1936 GenerateLoadMiss(masm(), Code::LOAD_IC); | 1968 GenerateLoadMiss(masm(), Code::LOAD_IC); |
1937 | 1969 |
1938 // Return the generated code. | 1970 // Return the generated code. |
1939 return GetCode(INTERCEPTOR, name); | 1971 return GetCode(INTERCEPTOR, name); |
1940 } | 1972 } |
1941 | 1973 |
1942 | 1974 |
1943 Object* LoadStubCompiler::CompileLoadGlobal(JSObject* object, | 1975 MaybeObject* LoadStubCompiler::CompileLoadGlobal(JSObject* object, |
1944 GlobalObject* holder, | 1976 GlobalObject* holder, |
1945 JSGlobalPropertyCell* cell, | 1977 JSGlobalPropertyCell* cell, |
1946 String* name, | 1978 String* name, |
1947 bool is_dont_delete) { | 1979 bool is_dont_delete) { |
1948 // ----------- S t a t e ------------- | 1980 // ----------- S t a t e ------------- |
1949 // -- rax : receiver | 1981 // -- rax : receiver |
1950 // -- rcx : name | 1982 // -- rcx : name |
1951 // -- rsp[0] : return address | 1983 // -- rsp[0] : return address |
1952 // ----------------------------------- | 1984 // ----------------------------------- |
1953 Label miss; | 1985 Label miss; |
1954 | 1986 |
1955 // 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 |
1956 // object which can only happen for contextual loads. In this case, | 1988 // object which can only happen for contextual loads. In this case, |
1957 // the receiver cannot be a smi. | 1989 // the receiver cannot be a smi. |
(...skipping 23 matching lines...) Expand all Loading... |
1981 | 2013 |
1982 __ bind(&miss); | 2014 __ bind(&miss); |
1983 __ IncrementCounter(&Counters::named_load_global_stub_miss, 1); | 2015 __ IncrementCounter(&Counters::named_load_global_stub_miss, 1); |
1984 GenerateLoadMiss(masm(), Code::LOAD_IC); | 2016 GenerateLoadMiss(masm(), Code::LOAD_IC); |
1985 | 2017 |
1986 // Return the generated code. | 2018 // Return the generated code. |
1987 return GetCode(NORMAL, name); | 2019 return GetCode(NORMAL, name); |
1988 } | 2020 } |
1989 | 2021 |
1990 | 2022 |
1991 Object* KeyedLoadStubCompiler::CompileLoadCallback(String* name, | 2023 MaybeObject* KeyedLoadStubCompiler::CompileLoadCallback( |
1992 JSObject* receiver, | 2024 String* name, |
1993 JSObject* holder, | 2025 JSObject* receiver, |
1994 AccessorInfo* callback) { | 2026 JSObject* holder, |
| 2027 AccessorInfo* callback) { |
1995 // ----------- S t a t e ------------- | 2028 // ----------- S t a t e ------------- |
1996 // -- rax : key | 2029 // -- rax : key |
1997 // -- rdx : receiver | 2030 // -- rdx : receiver |
1998 // -- rsp[0] : return address | 2031 // -- rsp[0] : return address |
1999 // ----------------------------------- | 2032 // ----------------------------------- |
2000 Label miss; | 2033 Label miss; |
2001 | 2034 |
2002 __ IncrementCounter(&Counters::keyed_load_callback, 1); | 2035 __ IncrementCounter(&Counters::keyed_load_callback, 1); |
2003 | 2036 |
2004 // Check that the name has not changed. | 2037 // Check that the name has not changed. |
(...skipping 10 matching lines...) Expand all Loading... |
2015 | 2048 |
2016 __ bind(&miss); | 2049 __ bind(&miss); |
2017 __ DecrementCounter(&Counters::keyed_load_callback, 1); | 2050 __ DecrementCounter(&Counters::keyed_load_callback, 1); |
2018 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 2051 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
2019 | 2052 |
2020 // Return the generated code. | 2053 // Return the generated code. |
2021 return GetCode(CALLBACKS, name); | 2054 return GetCode(CALLBACKS, name); |
2022 } | 2055 } |
2023 | 2056 |
2024 | 2057 |
2025 Object* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) { | 2058 MaybeObject* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) { |
2026 // ----------- S t a t e ------------- | 2059 // ----------- S t a t e ------------- |
2027 // -- rax : key | 2060 // -- rax : key |
2028 // -- rdx : receiver | 2061 // -- rdx : receiver |
2029 // -- rsp[0] : return address | 2062 // -- rsp[0] : return address |
2030 // ----------------------------------- | 2063 // ----------------------------------- |
2031 Label miss; | 2064 Label miss; |
2032 | 2065 |
2033 __ IncrementCounter(&Counters::keyed_load_array_length, 1); | 2066 __ IncrementCounter(&Counters::keyed_load_array_length, 1); |
2034 | 2067 |
2035 // Check that the name has not changed. | 2068 // Check that the name has not changed. |
2036 __ Cmp(rax, Handle<String>(name)); | 2069 __ Cmp(rax, Handle<String>(name)); |
2037 __ j(not_equal, &miss); | 2070 __ j(not_equal, &miss); |
2038 | 2071 |
2039 GenerateLoadArrayLength(masm(), rdx, rcx, &miss); | 2072 GenerateLoadArrayLength(masm(), rdx, rcx, &miss); |
2040 __ bind(&miss); | 2073 __ bind(&miss); |
2041 __ DecrementCounter(&Counters::keyed_load_array_length, 1); | 2074 __ DecrementCounter(&Counters::keyed_load_array_length, 1); |
2042 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 2075 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
2043 | 2076 |
2044 // Return the generated code. | 2077 // Return the generated code. |
2045 return GetCode(CALLBACKS, name); | 2078 return GetCode(CALLBACKS, name); |
2046 } | 2079 } |
2047 | 2080 |
2048 | 2081 |
2049 Object* KeyedLoadStubCompiler::CompileLoadConstant(String* name, | 2082 MaybeObject* KeyedLoadStubCompiler::CompileLoadConstant(String* name, |
2050 JSObject* receiver, | 2083 JSObject* receiver, |
2051 JSObject* holder, | 2084 JSObject* holder, |
2052 Object* value) { | 2085 Object* value) { |
2053 // ----------- S t a t e ------------- | 2086 // ----------- S t a t e ------------- |
2054 // -- rax : key | 2087 // -- rax : key |
2055 // -- rdx : receiver | 2088 // -- rdx : receiver |
2056 // -- rsp[0] : return address | 2089 // -- rsp[0] : return address |
2057 // ----------------------------------- | 2090 // ----------------------------------- |
2058 Label miss; | 2091 Label miss; |
2059 | 2092 |
2060 __ IncrementCounter(&Counters::keyed_load_constant_function, 1); | 2093 __ IncrementCounter(&Counters::keyed_load_constant_function, 1); |
2061 | 2094 |
2062 // Check that the name has not changed. | 2095 // Check that the name has not changed. |
2063 __ Cmp(rax, Handle<String>(name)); | 2096 __ Cmp(rax, Handle<String>(name)); |
2064 __ j(not_equal, &miss); | 2097 __ j(not_equal, &miss); |
2065 | 2098 |
2066 GenerateLoadConstant(receiver, holder, rdx, rbx, rcx, rdi, | 2099 GenerateLoadConstant(receiver, holder, rdx, rbx, rcx, rdi, |
2067 value, name, &miss); | 2100 value, name, &miss); |
2068 __ bind(&miss); | 2101 __ bind(&miss); |
2069 __ DecrementCounter(&Counters::keyed_load_constant_function, 1); | 2102 __ DecrementCounter(&Counters::keyed_load_constant_function, 1); |
2070 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 2103 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
2071 | 2104 |
2072 // Return the generated code. | 2105 // Return the generated code. |
2073 return GetCode(CONSTANT_FUNCTION, name); | 2106 return GetCode(CONSTANT_FUNCTION, name); |
2074 } | 2107 } |
2075 | 2108 |
2076 | 2109 |
2077 Object* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) { | 2110 MaybeObject* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) { |
2078 // ----------- S t a t e ------------- | 2111 // ----------- S t a t e ------------- |
2079 // -- rax : key | 2112 // -- rax : key |
2080 // -- rdx : receiver | 2113 // -- rdx : receiver |
2081 // -- rsp[0] : return address | 2114 // -- rsp[0] : return address |
2082 // ----------------------------------- | 2115 // ----------------------------------- |
2083 Label miss; | 2116 Label miss; |
2084 | 2117 |
2085 __ IncrementCounter(&Counters::keyed_load_function_prototype, 1); | 2118 __ IncrementCounter(&Counters::keyed_load_function_prototype, 1); |
2086 | 2119 |
2087 // Check that the name has not changed. | 2120 // Check that the name has not changed. |
2088 __ Cmp(rax, Handle<String>(name)); | 2121 __ Cmp(rax, Handle<String>(name)); |
2089 __ j(not_equal, &miss); | 2122 __ j(not_equal, &miss); |
2090 | 2123 |
2091 GenerateLoadFunctionPrototype(masm(), rdx, rcx, rbx, &miss); | 2124 GenerateLoadFunctionPrototype(masm(), rdx, rcx, rbx, &miss); |
2092 __ bind(&miss); | 2125 __ bind(&miss); |
2093 __ DecrementCounter(&Counters::keyed_load_function_prototype, 1); | 2126 __ DecrementCounter(&Counters::keyed_load_function_prototype, 1); |
2094 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 2127 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
2095 | 2128 |
2096 // Return the generated code. | 2129 // Return the generated code. |
2097 return GetCode(CALLBACKS, name); | 2130 return GetCode(CALLBACKS, name); |
2098 } | 2131 } |
2099 | 2132 |
2100 | 2133 |
2101 Object* KeyedLoadStubCompiler::CompileLoadInterceptor(JSObject* receiver, | 2134 MaybeObject* KeyedLoadStubCompiler::CompileLoadInterceptor(JSObject* receiver, |
2102 JSObject* holder, | 2135 JSObject* holder, |
2103 String* name) { | 2136 String* name) { |
2104 // ----------- S t a t e ------------- | 2137 // ----------- S t a t e ------------- |
2105 // -- rax : key | 2138 // -- rax : key |
2106 // -- rdx : receiver | 2139 // -- rdx : receiver |
2107 // -- rsp[0] : return address | 2140 // -- rsp[0] : return address |
2108 // ----------------------------------- | 2141 // ----------------------------------- |
2109 Label miss; | 2142 Label miss; |
2110 | 2143 |
2111 __ IncrementCounter(&Counters::keyed_load_interceptor, 1); | 2144 __ IncrementCounter(&Counters::keyed_load_interceptor, 1); |
2112 | 2145 |
2113 // Check that the name has not changed. | 2146 // Check that the name has not changed. |
(...skipping 14 matching lines...) Expand all Loading... |
2128 &miss); | 2161 &miss); |
2129 __ bind(&miss); | 2162 __ bind(&miss); |
2130 __ DecrementCounter(&Counters::keyed_load_interceptor, 1); | 2163 __ DecrementCounter(&Counters::keyed_load_interceptor, 1); |
2131 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 2164 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
2132 | 2165 |
2133 // Return the generated code. | 2166 // Return the generated code. |
2134 return GetCode(INTERCEPTOR, name); | 2167 return GetCode(INTERCEPTOR, name); |
2135 } | 2168 } |
2136 | 2169 |
2137 | 2170 |
2138 Object* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) { | 2171 MaybeObject* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) { |
2139 // ----------- S t a t e ------------- | 2172 // ----------- S t a t e ------------- |
2140 // -- rax : key | 2173 // -- rax : key |
2141 // -- rdx : receiver | 2174 // -- rdx : receiver |
2142 // -- rsp[0] : return address | 2175 // -- rsp[0] : return address |
2143 // ----------------------------------- | 2176 // ----------------------------------- |
2144 Label miss; | 2177 Label miss; |
2145 | 2178 |
2146 __ IncrementCounter(&Counters::keyed_load_string_length, 1); | 2179 __ IncrementCounter(&Counters::keyed_load_string_length, 1); |
2147 | 2180 |
2148 // Check that the name has not changed. | 2181 // Check that the name has not changed. |
2149 __ Cmp(rax, Handle<String>(name)); | 2182 __ Cmp(rax, Handle<String>(name)); |
2150 __ j(not_equal, &miss); | 2183 __ j(not_equal, &miss); |
2151 | 2184 |
2152 GenerateLoadStringLength(masm(), rdx, rcx, rbx, &miss); | 2185 GenerateLoadStringLength(masm(), rdx, rcx, rbx, &miss); |
2153 __ bind(&miss); | 2186 __ bind(&miss); |
2154 __ DecrementCounter(&Counters::keyed_load_string_length, 1); | 2187 __ DecrementCounter(&Counters::keyed_load_string_length, 1); |
2155 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 2188 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
2156 | 2189 |
2157 // Return the generated code. | 2190 // Return the generated code. |
2158 return GetCode(CALLBACKS, name); | 2191 return GetCode(CALLBACKS, name); |
2159 } | 2192 } |
2160 | 2193 |
2161 | 2194 |
2162 Object* StoreStubCompiler::CompileStoreCallback(JSObject* object, | 2195 MaybeObject* StoreStubCompiler::CompileStoreCallback(JSObject* object, |
2163 AccessorInfo* callback, | 2196 AccessorInfo* callback, |
2164 String* name) { | 2197 String* name) { |
2165 // ----------- S t a t e ------------- | 2198 // ----------- S t a t e ------------- |
2166 // -- rax : value | 2199 // -- rax : value |
2167 // -- rcx : name | 2200 // -- rcx : name |
2168 // -- rdx : receiver | 2201 // -- rdx : receiver |
2169 // -- rsp[0] : return address | 2202 // -- rsp[0] : return address |
2170 // ----------------------------------- | 2203 // ----------------------------------- |
2171 Label miss; | 2204 Label miss; |
2172 | 2205 |
2173 // Check that the object isn't a smi. | 2206 // Check that the object isn't a smi. |
2174 __ JumpIfSmi(rdx, &miss); | 2207 __ JumpIfSmi(rdx, &miss); |
(...skipping 27 matching lines...) Expand all Loading... |
2202 // Handle store cache miss. | 2235 // Handle store cache miss. |
2203 __ bind(&miss); | 2236 __ bind(&miss); |
2204 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); | 2237 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); |
2205 __ Jump(ic, RelocInfo::CODE_TARGET); | 2238 __ Jump(ic, RelocInfo::CODE_TARGET); |
2206 | 2239 |
2207 // Return the generated code. | 2240 // Return the generated code. |
2208 return GetCode(CALLBACKS, name); | 2241 return GetCode(CALLBACKS, name); |
2209 } | 2242 } |
2210 | 2243 |
2211 | 2244 |
2212 Object* StoreStubCompiler::CompileStoreField(JSObject* object, | 2245 MaybeObject* StoreStubCompiler::CompileStoreField(JSObject* object, |
2213 int index, | 2246 int index, |
2214 Map* transition, | 2247 Map* transition, |
2215 String* name) { | 2248 String* name) { |
2216 // ----------- S t a t e ------------- | 2249 // ----------- S t a t e ------------- |
2217 // -- rax : value | 2250 // -- rax : value |
2218 // -- rcx : name | 2251 // -- rcx : name |
2219 // -- rdx : receiver | 2252 // -- rdx : receiver |
2220 // -- rsp[0] : return address | 2253 // -- rsp[0] : return address |
2221 // ----------------------------------- | 2254 // ----------------------------------- |
2222 Label miss; | 2255 Label miss; |
2223 | 2256 |
2224 // 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. |
2225 GenerateStoreField(masm(), | 2258 GenerateStoreField(masm(), |
2226 object, | 2259 object, |
2227 index, | 2260 index, |
2228 transition, | 2261 transition, |
2229 rdx, rcx, rbx, | 2262 rdx, rcx, rbx, |
2230 &miss); | 2263 &miss); |
2231 | 2264 |
2232 // Handle store cache miss. | 2265 // Handle store cache miss. |
2233 __ bind(&miss); | 2266 __ bind(&miss); |
2234 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); | 2267 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); |
2235 __ Jump(ic, RelocInfo::CODE_TARGET); | 2268 __ Jump(ic, RelocInfo::CODE_TARGET); |
2236 | 2269 |
2237 // Return the generated code. | 2270 // Return the generated code. |
2238 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name); | 2271 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name); |
2239 } | 2272 } |
2240 | 2273 |
2241 | 2274 |
2242 Object* StoreStubCompiler::CompileStoreInterceptor(JSObject* receiver, | 2275 MaybeObject* StoreStubCompiler::CompileStoreInterceptor(JSObject* receiver, |
2243 String* name) { | 2276 String* name) { |
2244 // ----------- S t a t e ------------- | 2277 // ----------- S t a t e ------------- |
2245 // -- rax : value | 2278 // -- rax : value |
2246 // -- rcx : name | 2279 // -- rcx : name |
2247 // -- rdx : receiver | 2280 // -- rdx : receiver |
2248 // -- rsp[0] : return address | 2281 // -- rsp[0] : return address |
2249 // ----------------------------------- | 2282 // ----------------------------------- |
2250 Label miss; | 2283 Label miss; |
2251 | 2284 |
2252 // Check that the object isn't a smi. | 2285 // Check that the object isn't a smi. |
2253 __ JumpIfSmi(rdx, &miss); | 2286 __ JumpIfSmi(rdx, &miss); |
(...skipping 26 matching lines...) Expand all Loading... |
2280 // Handle store cache miss. | 2313 // Handle store cache miss. |
2281 __ bind(&miss); | 2314 __ bind(&miss); |
2282 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); | 2315 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); |
2283 __ Jump(ic, RelocInfo::CODE_TARGET); | 2316 __ Jump(ic, RelocInfo::CODE_TARGET); |
2284 | 2317 |
2285 // Return the generated code. | 2318 // Return the generated code. |
2286 return GetCode(INTERCEPTOR, name); | 2319 return GetCode(INTERCEPTOR, name); |
2287 } | 2320 } |
2288 | 2321 |
2289 | 2322 |
2290 Object* StoreStubCompiler::CompileStoreGlobal(GlobalObject* object, | 2323 MaybeObject* StoreStubCompiler::CompileStoreGlobal(GlobalObject* object, |
2291 JSGlobalPropertyCell* cell, | 2324 JSGlobalPropertyCell* cell, |
2292 String* name) { | 2325 String* name) { |
2293 // ----------- S t a t e ------------- | 2326 // ----------- S t a t e ------------- |
2294 // -- rax : value | 2327 // -- rax : value |
2295 // -- rcx : name | 2328 // -- rcx : name |
2296 // -- rdx : receiver | 2329 // -- rdx : receiver |
2297 // -- rsp[0] : return address | 2330 // -- rsp[0] : return address |
2298 // ----------------------------------- | 2331 // ----------------------------------- |
2299 Label miss; | 2332 Label miss; |
2300 | 2333 |
2301 // Check that the map of the global has not changed. | 2334 // Check that the map of the global has not changed. |
2302 __ Cmp(FieldOperand(rdx, HeapObject::kMapOffset), | 2335 __ Cmp(FieldOperand(rdx, HeapObject::kMapOffset), |
(...skipping 12 matching lines...) Expand all Loading... |
2315 __ bind(&miss); | 2348 __ bind(&miss); |
2316 __ IncrementCounter(&Counters::named_store_global_inline_miss, 1); | 2349 __ IncrementCounter(&Counters::named_store_global_inline_miss, 1); |
2317 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); | 2350 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); |
2318 __ Jump(ic, RelocInfo::CODE_TARGET); | 2351 __ Jump(ic, RelocInfo::CODE_TARGET); |
2319 | 2352 |
2320 // Return the generated code. | 2353 // Return the generated code. |
2321 return GetCode(NORMAL, name); | 2354 return GetCode(NORMAL, name); |
2322 } | 2355 } |
2323 | 2356 |
2324 | 2357 |
2325 Object* KeyedLoadStubCompiler::CompileLoadField(String* name, | 2358 MaybeObject* KeyedLoadStubCompiler::CompileLoadField(String* name, |
2326 JSObject* receiver, | 2359 JSObject* receiver, |
2327 JSObject* holder, | 2360 JSObject* holder, |
2328 int index) { | 2361 int index) { |
2329 // ----------- S t a t e ------------- | 2362 // ----------- S t a t e ------------- |
2330 // -- rax : key | 2363 // -- rax : key |
2331 // -- rdx : receiver | 2364 // -- rdx : receiver |
2332 // -- rsp[0] : return address | 2365 // -- rsp[0] : return address |
2333 // ----------------------------------- | 2366 // ----------------------------------- |
2334 Label miss; | 2367 Label miss; |
2335 | 2368 |
2336 __ IncrementCounter(&Counters::keyed_load_field, 1); | 2369 __ IncrementCounter(&Counters::keyed_load_field, 1); |
2337 | 2370 |
2338 // Check that the name has not changed. | 2371 // Check that the name has not changed. |
2339 __ Cmp(rax, Handle<String>(name)); | 2372 __ Cmp(rax, Handle<String>(name)); |
2340 __ j(not_equal, &miss); | 2373 __ j(not_equal, &miss); |
2341 | 2374 |
2342 GenerateLoadField(receiver, holder, rdx, rbx, rcx, rdi, index, name, &miss); | 2375 GenerateLoadField(receiver, holder, rdx, rbx, rcx, rdi, index, name, &miss); |
2343 | 2376 |
2344 __ bind(&miss); | 2377 __ bind(&miss); |
2345 __ DecrementCounter(&Counters::keyed_load_field, 1); | 2378 __ DecrementCounter(&Counters::keyed_load_field, 1); |
2346 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 2379 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
2347 | 2380 |
2348 // Return the generated code. | 2381 // Return the generated code. |
2349 return GetCode(FIELD, name); | 2382 return GetCode(FIELD, name); |
2350 } | 2383 } |
2351 | 2384 |
2352 | 2385 |
2353 Object* KeyedStoreStubCompiler::CompileStoreField(JSObject* object, | 2386 MaybeObject* KeyedStoreStubCompiler::CompileStoreField(JSObject* object, |
2354 int index, | 2387 int index, |
2355 Map* transition, | 2388 Map* transition, |
2356 String* name) { | 2389 String* name) { |
2357 // ----------- S t a t e ------------- | 2390 // ----------- S t a t e ------------- |
2358 // -- rax : value | 2391 // -- rax : value |
2359 // -- rcx : key | 2392 // -- rcx : key |
2360 // -- rdx : receiver | 2393 // -- rdx : receiver |
2361 // -- rsp[0] : return address | 2394 // -- rsp[0] : return address |
2362 // ----------------------------------- | 2395 // ----------------------------------- |
2363 Label miss; | 2396 Label miss; |
2364 | 2397 |
2365 __ IncrementCounter(&Counters::keyed_store_field, 1); | 2398 __ IncrementCounter(&Counters::keyed_store_field, 1); |
2366 | 2399 |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2584 #ifdef _WIN64 | 2617 #ifdef _WIN64 |
2585 // 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 |
2586 // a pointer to it into 1st arg register. | 2619 // a pointer to it into 1st arg register. |
2587 __ push(Immediate(0)); | 2620 __ push(Immediate(0)); |
2588 __ movq(rcx, rsp); | 2621 __ movq(rcx, rsp); |
2589 #endif | 2622 #endif |
2590 // 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 |
2591 // already generated). Do not allow the assembler to perform a | 2624 // already generated). Do not allow the assembler to perform a |
2592 // garbage collection but instead return the allocation failure | 2625 // garbage collection but instead return the allocation failure |
2593 // object. | 2626 // object. |
2594 Object* result = masm()->TryCallStub(&stub); | 2627 MaybeObject* result = masm()->TryCallStub(&stub); |
2595 if (result->IsFailure()) { | 2628 if (result->IsFailure()) { |
2596 *failure = Failure::cast(result); | 2629 *failure = Failure::cast(result); |
2597 return false; | 2630 return false; |
2598 } | 2631 } |
2599 #ifdef _WIN64 | 2632 #ifdef _WIN64 |
2600 // Discard allocated slot. | 2633 // Discard allocated slot. |
2601 __ addq(rsp, Immediate(kPointerSize)); | 2634 __ addq(rsp, Immediate(kPointerSize)); |
2602 #endif | 2635 #endif |
2603 __ LeaveInternalFrame(); | 2636 __ LeaveInternalFrame(); |
2604 | 2637 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2640 | 2673 |
2641 // Only global objects and objects that do not require access | 2674 // Only global objects and objects that do not require access |
2642 // checks are allowed in stubs. | 2675 // checks are allowed in stubs. |
2643 ASSERT(current->IsJSGlobalProxy() || !current->IsAccessCheckNeeded()); | 2676 ASSERT(current->IsJSGlobalProxy() || !current->IsAccessCheckNeeded()); |
2644 | 2677 |
2645 JSObject* prototype = JSObject::cast(current->GetPrototype()); | 2678 JSObject* prototype = JSObject::cast(current->GetPrototype()); |
2646 if (!current->HasFastProperties() && | 2679 if (!current->HasFastProperties() && |
2647 !current->IsJSGlobalObject() && | 2680 !current->IsJSGlobalObject() && |
2648 !current->IsJSGlobalProxy()) { | 2681 !current->IsJSGlobalProxy()) { |
2649 if (!name->IsSymbol()) { | 2682 if (!name->IsSymbol()) { |
2650 Object* lookup_result = Heap::LookupSymbol(name); | 2683 MaybeObject* lookup_result = Heap::LookupSymbol(name); |
2651 if (lookup_result->IsFailure()) { | 2684 if (lookup_result->IsFailure()) { |
2652 set_failure(Failure::cast(lookup_result)); | 2685 set_failure(Failure::cast(lookup_result)); |
2653 return reg; | 2686 return reg; |
2654 } else { | 2687 } else { |
2655 name = String::cast(lookup_result); | 2688 name = String::cast(lookup_result->ToObjectUnchecked()); |
2656 } | 2689 } |
2657 } | 2690 } |
2658 ASSERT(current->property_dictionary()->FindEntry(name) == | 2691 ASSERT(current->property_dictionary()->FindEntry(name) == |
2659 StringDictionary::kNotFound); | 2692 StringDictionary::kNotFound); |
2660 | 2693 |
2661 GenerateDictionaryNegativeLookup(masm(), | 2694 GenerateDictionaryNegativeLookup(masm(), |
2662 miss, | 2695 miss, |
2663 reg, | 2696 reg, |
2664 name, | 2697 name, |
2665 scratch1, | 2698 scratch1, |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2727 if (current->IsJSGlobalProxy()) { | 2760 if (current->IsJSGlobalProxy()) { |
2728 __ CheckAccessGlobalProxy(reg, scratch1, miss); | 2761 __ CheckAccessGlobalProxy(reg, scratch1, miss); |
2729 } | 2762 } |
2730 | 2763 |
2731 // 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 |
2732 // 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 |
2733 // property cell for the property is still empty. | 2766 // property cell for the property is still empty. |
2734 current = object; | 2767 current = object; |
2735 while (current != holder) { | 2768 while (current != holder) { |
2736 if (current->IsGlobalObject()) { | 2769 if (current->IsGlobalObject()) { |
2737 Object* cell = GenerateCheckPropertyCell(masm(), | 2770 MaybeObject* cell = GenerateCheckPropertyCell(masm(), |
2738 GlobalObject::cast(current), | 2771 GlobalObject::cast(current), |
2739 name, | 2772 name, |
2740 scratch1, | 2773 scratch1, |
2741 miss); | 2774 miss); |
2742 if (cell->IsFailure()) { | 2775 if (cell->IsFailure()) { |
2743 set_failure(Failure::cast(cell)); | 2776 set_failure(Failure::cast(cell)); |
2744 return reg; | 2777 return reg; |
2745 } | 2778 } |
2746 } | 2779 } |
2747 current = JSObject::cast(current->GetPrototype()); | 2780 current = JSObject::cast(current->GetPrototype()); |
2748 } | 2781 } |
2749 | 2782 |
2750 // Return the register containing the holder. | 2783 // Return the register containing the holder. |
2751 return reg; | 2784 return reg; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2793 scratch1, scratch2, scratch3, name, miss); | 2826 scratch1, scratch2, scratch3, name, miss); |
2794 | 2827 |
2795 // Return the constant value. | 2828 // Return the constant value. |
2796 __ Move(rax, Handle<Object>(value)); | 2829 __ Move(rax, Handle<Object>(value)); |
2797 __ ret(0); | 2830 __ ret(0); |
2798 } | 2831 } |
2799 | 2832 |
2800 | 2833 |
2801 // Specialized stub for constructing objects from functions which only have only | 2834 // Specialized stub for constructing objects from functions which only have only |
2802 // simple assignments of the form this.x = ...; in their body. | 2835 // simple assignments of the form this.x = ...; in their body. |
2803 Object* ConstructStubCompiler::CompileConstructStub( | 2836 MaybeObject* ConstructStubCompiler::CompileConstructStub( |
2804 SharedFunctionInfo* shared) { | 2837 SharedFunctionInfo* shared) { |
2805 // ----------- S t a t e ------------- | 2838 // ----------- S t a t e ------------- |
2806 // -- rax : argc | 2839 // -- rax : argc |
2807 // -- rdi : constructor | 2840 // -- rdi : constructor |
2808 // -- rsp[0] : return address | 2841 // -- rsp[0] : return address |
2809 // -- rsp[4] : last argument | 2842 // -- rsp[4] : last argument |
2810 // ----------------------------------- | 2843 // ----------------------------------- |
2811 Label generic_stub_call; | 2844 Label generic_stub_call; |
2812 | 2845 |
2813 // 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 Loading... |
2926 // Return the generated code. | 2959 // Return the generated code. |
2927 return GetCode(); | 2960 return GetCode(); |
2928 } | 2961 } |
2929 | 2962 |
2930 | 2963 |
2931 #undef __ | 2964 #undef __ |
2932 | 2965 |
2933 } } // namespace v8::internal | 2966 } } // namespace v8::internal |
2934 | 2967 |
2935 #endif // V8_TARGET_ARCH_X64 | 2968 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |