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

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

Issue 3970005: Make Failure inherit from MaybeObject instead of Object. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ia32/regexp-macro-assembler-ia32.cc ('k') | src/ic.h » ('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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 } 800 }
801 801
802 // Return the value (register eax). 802 // Return the value (register eax).
803 __ ret(0); 803 __ ret(0);
804 } 804 }
805 805
806 806
807 // Generate code to check that a global property cell is empty. Create 807 // Generate code to check that a global property cell is empty. Create
808 // the property cell at compilation time if no cell exists for the 808 // the property cell at compilation time if no cell exists for the
809 // property. 809 // property.
810 static Object* GenerateCheckPropertyCell(MacroAssembler* masm, 810 MUST_USE_RESULT static MaybeObject* GenerateCheckPropertyCell(
811 GlobalObject* global, 811 MacroAssembler* masm,
812 String* name, 812 GlobalObject* global,
813 Register scratch, 813 String* name,
814 Label* miss) { 814 Register scratch,
815 Object* probe = global->EnsurePropertyCell(name); 815 Label* miss) {
816 if (probe->IsFailure()) return probe; 816 Object* probe;
817 { MaybeObject* maybe_probe = global->EnsurePropertyCell(name);
818 if (!maybe_probe->ToObject(&probe)) return maybe_probe;
819 }
817 JSGlobalPropertyCell* cell = JSGlobalPropertyCell::cast(probe); 820 JSGlobalPropertyCell* cell = JSGlobalPropertyCell::cast(probe);
818 ASSERT(cell->value()->IsTheHole()); 821 ASSERT(cell->value()->IsTheHole());
819 __ mov(scratch, Immediate(Handle<Object>(cell))); 822 __ mov(scratch, Immediate(Handle<Object>(cell)));
820 __ cmp(FieldOperand(scratch, JSGlobalPropertyCell::kValueOffset), 823 __ cmp(FieldOperand(scratch, JSGlobalPropertyCell::kValueOffset),
821 Immediate(Factory::the_hole_value())); 824 Immediate(Factory::the_hole_value()));
822 __ j(not_equal, miss, not_taken); 825 __ j(not_equal, miss, not_taken);
823 return cell; 826 return cell;
824 } 827 }
825 828
826 829
827 // Calls GenerateCheckPropertyCell for each global object in the prototype chain 830 // Calls GenerateCheckPropertyCell for each global object in the prototype chain
828 // from object to (but not including) holder. 831 // from object to (but not including) holder.
829 static Object* GenerateCheckPropertyCells(MacroAssembler* masm, 832 MUST_USE_RESULT static MaybeObject* GenerateCheckPropertyCells(
830 JSObject* object, 833 MacroAssembler* masm,
831 JSObject* holder, 834 JSObject* object,
832 String* name, 835 JSObject* holder,
833 Register scratch, 836 String* name,
834 Label* miss) { 837 Register scratch,
838 Label* miss) {
835 JSObject* current = object; 839 JSObject* current = object;
836 while (current != holder) { 840 while (current != holder) {
837 if (current->IsGlobalObject()) { 841 if (current->IsGlobalObject()) {
838 Object* cell = GenerateCheckPropertyCell(masm, 842 // Returns a cell or a failure.
839 GlobalObject::cast(current), 843 MaybeObject* result = GenerateCheckPropertyCell(
840 name, 844 masm,
841 scratch, 845 GlobalObject::cast(current),
842 miss); 846 name,
843 if (cell->IsFailure()) { 847 scratch,
844 return cell; 848 miss);
845 } 849 if (result->IsFailure()) return t;
846 } 850 }
847 ASSERT(current->IsJSObject()); 851 ASSERT(current->IsJSObject());
848 current = JSObject::cast(current->GetPrototype()); 852 current = JSObject::cast(current->GetPrototype());
849 } 853 }
850 return NULL; 854 return NULL;
851 } 855 }
852 856
853 857
854 #undef __ 858 #undef __
855 #define __ ACCESS_MASM(masm()) 859 #define __ ACCESS_MASM(masm())
(...skipping 29 matching lines...) Expand all
885 // Only global objects and objects that do not require access 889 // Only global objects and objects that do not require access
886 // checks are allowed in stubs. 890 // checks are allowed in stubs.
887 ASSERT(current->IsJSGlobalProxy() || !current->IsAccessCheckNeeded()); 891 ASSERT(current->IsJSGlobalProxy() || !current->IsAccessCheckNeeded());
888 892
889 ASSERT(current->GetPrototype()->IsJSObject()); 893 ASSERT(current->GetPrototype()->IsJSObject());
890 JSObject* prototype = JSObject::cast(current->GetPrototype()); 894 JSObject* prototype = JSObject::cast(current->GetPrototype());
891 if (!current->HasFastProperties() && 895 if (!current->HasFastProperties() &&
892 !current->IsJSGlobalObject() && 896 !current->IsJSGlobalObject() &&
893 !current->IsJSGlobalProxy()) { 897 !current->IsJSGlobalProxy()) {
894 if (!name->IsSymbol()) { 898 if (!name->IsSymbol()) {
895 Object* lookup_result = Heap::LookupSymbol(name); 899 MaybeObject* maybe_lookup_result = Heap::LookupSymbol(name);
896 if (lookup_result->IsFailure()) { 900 Object* lookup_result = NULL; // Initialization to please compiler.
901 if (!maybe_lookup_result->ToObject(&lookup_result)) {
897 set_failure(Failure::cast(lookup_result)); 902 set_failure(Failure::cast(lookup_result));
898 return reg; 903 return reg;
899 } else {
900 name = String::cast(lookup_result);
901 } 904 }
905 name = String::cast(lookup_result);
902 } 906 }
903 ASSERT(current->property_dictionary()->FindEntry(name) == 907 ASSERT(current->property_dictionary()->FindEntry(name) ==
904 StringDictionary::kNotFound); 908 StringDictionary::kNotFound);
905 909
906 GenerateDictionaryNegativeLookup(masm(), 910 GenerateDictionaryNegativeLookup(masm(),
907 miss, 911 miss,
908 reg, 912 reg,
909 name, 913 name,
910 scratch1, 914 scratch1,
911 scratch2); 915 scratch2);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 972
969 // Perform security check for access to the global object. 973 // Perform security check for access to the global object.
970 ASSERT(holder->IsJSGlobalProxy() || !holder->IsAccessCheckNeeded()); 974 ASSERT(holder->IsJSGlobalProxy() || !holder->IsAccessCheckNeeded());
971 if (holder->IsJSGlobalProxy()) { 975 if (holder->IsJSGlobalProxy()) {
972 __ CheckAccessGlobalProxy(reg, scratch1, miss); 976 __ CheckAccessGlobalProxy(reg, scratch1, miss);
973 }; 977 };
974 978
975 // If we've skipped any global objects, it's not enough to verify 979 // If we've skipped any global objects, it's not enough to verify
976 // that their maps haven't changed. We also need to check that the 980 // that their maps haven't changed. We also need to check that the
977 // property cell for the property is still empty. 981 // property cell for the property is still empty.
978 Object* result = GenerateCheckPropertyCells(masm(), 982 MaybeObject* result = GenerateCheckPropertyCells(masm(),
979 object, 983 object,
980 holder, 984 holder,
981 name, 985 name,
982 scratch1, 986 scratch1,
983 miss); 987 miss);
984 if (result->IsFailure()) set_failure(Failure::cast(result)); 988 if (result->IsFailure()) set_failure(Failure::cast(result));
985 989
986 // Return the register containing the holder. 990 // Return the register containing the holder.
987 return reg; 991 return reg;
988 } 992 }
989 993
990 994
991 void StubCompiler::GenerateLoadField(JSObject* object, 995 void StubCompiler::GenerateLoadField(JSObject* object,
992 JSObject* holder, 996 JSObject* holder,
993 Register receiver, 997 Register receiver,
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 1061
1058 // Do call through the api. 1062 // Do call through the api.
1059 ASSERT_EQ(5, ApiGetterEntryStub::kStackSpace); 1063 ASSERT_EQ(5, ApiGetterEntryStub::kStackSpace);
1060 Address getter_address = v8::ToCData<Address>(callback->getter()); 1064 Address getter_address = v8::ToCData<Address>(callback->getter());
1061 ApiFunction fun(getter_address); 1065 ApiFunction fun(getter_address);
1062 ApiGetterEntryStub stub(callback_handle, &fun); 1066 ApiGetterEntryStub stub(callback_handle, &fun);
1063 // Emitting a stub call may try to allocate (if the code is not 1067 // Emitting a stub call may try to allocate (if the code is not
1064 // already generated). Do not allow the assembler to perform a 1068 // already generated). Do not allow the assembler to perform a
1065 // garbage collection but instead return the allocation failure 1069 // garbage collection but instead return the allocation failure
1066 // object. 1070 // object.
1067 Object* result = masm()->TryCallStub(&stub); 1071 Object* result = NULL; // Initialization to please compiler.
1068 if (result->IsFailure()) { 1072 { MaybeObject* try_call_result = masm()->TryCallStub(&stub);
1069 *failure = Failure::cast(result); 1073 if (!try_call_result->ToObject(&result)) {
1070 return false; 1074 *failure = Failure::cast(result);
1075 return false;
1076 }
1071 } 1077 }
1072 __ LeaveInternalFrame(); 1078 __ LeaveInternalFrame();
1073 1079
1074 __ ret(0); 1080 __ ret(0);
1075 return true; 1081 return true;
1076 } 1082 }
1077 1083
1078 1084
1079 void StubCompiler::GenerateLoadConstant(JSObject* object, 1085 void StubCompiler::GenerateLoadConstant(JSObject* object,
1080 JSObject* holder, 1086 JSObject* holder,
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
1295 __ cmp(FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset), 1301 __ cmp(FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset),
1296 Immediate(Handle<SharedFunctionInfo>(function->shared()))); 1302 Immediate(Handle<SharedFunctionInfo>(function->shared())));
1297 __ j(not_equal, miss, not_taken); 1303 __ j(not_equal, miss, not_taken);
1298 } else { 1304 } else {
1299 __ cmp(Operand(edi), Immediate(Handle<JSFunction>(function))); 1305 __ cmp(Operand(edi), Immediate(Handle<JSFunction>(function)));
1300 __ j(not_equal, miss, not_taken); 1306 __ j(not_equal, miss, not_taken);
1301 } 1307 }
1302 } 1308 }
1303 1309
1304 1310
1305 Object* CallStubCompiler::GenerateMissBranch() { 1311 MaybeObject* CallStubCompiler::GenerateMissBranch() {
1306 Object* obj = StubCache::ComputeCallMiss(arguments().immediate(), kind_); 1312 Object* obj;
1307 if (obj->IsFailure()) return obj; 1313 { MaybeObject* maybe_obj =
1314 StubCache::ComputeCallMiss(arguments().immediate(), kind_);
1315 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
1316 }
1308 __ jmp(Handle<Code>(Code::cast(obj)), RelocInfo::CODE_TARGET); 1317 __ jmp(Handle<Code>(Code::cast(obj)), RelocInfo::CODE_TARGET);
1309 return obj; 1318 return obj;
1310 } 1319 }
1311 1320
1312 1321
1313 Object* CallStubCompiler::CompileCallField(JSObject* object, 1322 MUST_USE_RESULT MaybeObject* CallStubCompiler::CompileCallField(
1314 JSObject* holder, 1323 JSObject* object,
1315 int index, 1324 JSObject* holder,
1316 String* name) { 1325 int index,
1326 String* name) {
1317 // ----------- S t a t e ------------- 1327 // ----------- S t a t e -------------
1318 // -- ecx : name 1328 // -- ecx : name
1319 // -- esp[0] : return address 1329 // -- esp[0] : return address
1320 // -- esp[(argc - n) * 4] : arg[n] (zero-based) 1330 // -- esp[(argc - n) * 4] : arg[n] (zero-based)
1321 // -- ... 1331 // -- ...
1322 // -- esp[(argc + 1) * 4] : receiver 1332 // -- esp[(argc + 1) * 4] : receiver
1323 // ----------------------------------- 1333 // -----------------------------------
1324 Label miss; 1334 Label miss;
1325 1335
1326 GenerateNameCheck(name, &miss); 1336 GenerateNameCheck(name, &miss);
(...skipping 23 matching lines...) Expand all
1350 if (object->IsGlobalObject()) { 1360 if (object->IsGlobalObject()) {
1351 __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset)); 1361 __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset));
1352 __ mov(Operand(esp, (argc + 1) * kPointerSize), edx); 1362 __ mov(Operand(esp, (argc + 1) * kPointerSize), edx);
1353 } 1363 }
1354 1364
1355 // Invoke the function. 1365 // Invoke the function.
1356 __ InvokeFunction(edi, arguments(), JUMP_FUNCTION); 1366 __ InvokeFunction(edi, arguments(), JUMP_FUNCTION);
1357 1367
1358 // Handle call cache miss. 1368 // Handle call cache miss.
1359 __ bind(&miss); 1369 __ bind(&miss);
1360 Object* obj = GenerateMissBranch(); 1370 Object* obj;
1361 if (obj->IsFailure()) return obj; 1371 { MaybeObject* maybe_obj = GenerateMissBranch();
1372 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
1373 }
1362 1374
1363 // Return the generated code. 1375 // Return the generated code.
1364 return GetCode(FIELD, name); 1376 return GetCode(FIELD, name);
1365 } 1377 }
1366 1378
1367 1379
1368 Object* CallStubCompiler::CompileArrayPushCall(Object* object, 1380 MaybeObject* CallStubCompiler::CompileArrayPushCall(Object* object,
1369 JSObject* holder, 1381 JSObject* holder,
1370 JSGlobalPropertyCell* cell, 1382 JSGlobalPropertyCell* cell,
1371 JSFunction* function, 1383 JSFunction* function,
1372 String* name) { 1384 String* name) {
1373 // ----------- S t a t e ------------- 1385 // ----------- S t a t e -------------
1374 // -- ecx : name 1386 // -- ecx : name
1375 // -- esp[0] : return address 1387 // -- esp[0] : return address
1376 // -- esp[(argc - n) * 4] : arg[n] (zero-based) 1388 // -- esp[(argc - n) * 4] : arg[n] (zero-based)
1377 // -- ... 1389 // -- ...
1378 // -- esp[(argc + 1) * 4] : receiver 1390 // -- esp[(argc + 1) * 4] : receiver
1379 // ----------------------------------- 1391 // -----------------------------------
1380 1392
1381 // If object is not an array, bail out to regular call. 1393 // If object is not an array, bail out to regular call.
1382 if (!object->IsJSArray() || cell != NULL) return Heap::undefined_value(); 1394 if (!object->IsJSArray() || cell != NULL) return Heap::undefined_value();
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1500 __ ret((argc + 1) * kPointerSize); 1512 __ ret((argc + 1) * kPointerSize);
1501 } 1513 }
1502 1514
1503 __ bind(&call_builtin); 1515 __ bind(&call_builtin);
1504 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush), 1516 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush),
1505 argc + 1, 1517 argc + 1,
1506 1); 1518 1);
1507 } 1519 }
1508 1520
1509 __ bind(&miss); 1521 __ bind(&miss);
1510 Object* obj = GenerateMissBranch(); 1522 Object* obj;
1511 if (obj->IsFailure()) return obj; 1523 { MaybeObject* maybe_obj = GenerateMissBranch();
1524 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
1525 }
1512 1526
1513 // Return the generated code. 1527 // Return the generated code.
1514 return GetCode(function); 1528 return GetCode(function);
1515 } 1529 }
1516 1530
1517 1531
1518 Object* CallStubCompiler::CompileArrayPopCall(Object* object, 1532 MaybeObject* CallStubCompiler::CompileArrayPopCall(Object* object,
1519 JSObject* holder, 1533 JSObject* holder,
1520 JSGlobalPropertyCell* cell, 1534 JSGlobalPropertyCell* cell,
1521 JSFunction* function, 1535 JSFunction* function,
1522 String* name) { 1536 String* name) {
1523 // ----------- S t a t e ------------- 1537 // ----------- S t a t e -------------
1524 // -- ecx : name 1538 // -- ecx : name
1525 // -- esp[0] : return address 1539 // -- esp[0] : return address
1526 // -- esp[(argc - n) * 4] : arg[n] (zero-based) 1540 // -- esp[(argc - n) * 4] : arg[n] (zero-based)
1527 // -- ... 1541 // -- ...
1528 // -- esp[(argc + 1) * 4] : receiver 1542 // -- esp[(argc + 1) * 4] : receiver
1529 // ----------------------------------- 1543 // -----------------------------------
1530 1544
1531 // If object is not an array, bail out to regular call. 1545 // If object is not an array, bail out to regular call.
1532 if (!object->IsJSArray() || cell != NULL) return Heap::undefined_value(); 1546 if (!object->IsJSArray() || cell != NULL) return Heap::undefined_value();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1581 __ bind(&return_undefined); 1595 __ bind(&return_undefined);
1582 __ mov(eax, Immediate(Factory::undefined_value())); 1596 __ mov(eax, Immediate(Factory::undefined_value()));
1583 __ ret((argc + 1) * kPointerSize); 1597 __ ret((argc + 1) * kPointerSize);
1584 1598
1585 __ bind(&call_builtin); 1599 __ bind(&call_builtin);
1586 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop), 1600 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop),
1587 argc + 1, 1601 argc + 1,
1588 1); 1602 1);
1589 1603
1590 __ bind(&miss); 1604 __ bind(&miss);
1591 Object* obj = GenerateMissBranch(); 1605 Object* obj;
1592 if (obj->IsFailure()) return obj; 1606 { MaybeObject* maybe_obj = GenerateMissBranch();
1607 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
1608 }
1593 1609
1594 // Return the generated code. 1610 // Return the generated code.
1595 return GetCode(function); 1611 return GetCode(function);
1596 } 1612 }
1597 1613
1598 1614
1599 Object* CallStubCompiler::CompileStringCharCodeAtCall( 1615 MaybeObject* CallStubCompiler::CompileStringCharCodeAtCall(
1600 Object* object, 1616 Object* object,
1601 JSObject* holder, 1617 JSObject* holder,
1602 JSGlobalPropertyCell* cell, 1618 JSGlobalPropertyCell* cell,
1603 JSFunction* function, 1619 JSFunction* function,
1604 String* name) { 1620 String* name) {
1605 // ----------- S t a t e ------------- 1621 // ----------- S t a t e -------------
1606 // -- ecx : function name 1622 // -- ecx : function name
1607 // -- esp[0] : return address 1623 // -- esp[0] : return address
1608 // -- esp[(argc - n) * 4] : arg[n] (zero-based) 1624 // -- esp[(argc - n) * 4] : arg[n] (zero-based)
1609 // -- ... 1625 // -- ...
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1651 __ ret((argc + 1) * kPointerSize); 1667 __ ret((argc + 1) * kPointerSize);
1652 1668
1653 ICRuntimeCallHelper call_helper; 1669 ICRuntimeCallHelper call_helper;
1654 char_code_at_generator.GenerateSlow(masm(), call_helper); 1670 char_code_at_generator.GenerateSlow(masm(), call_helper);
1655 1671
1656 __ bind(&index_out_of_range); 1672 __ bind(&index_out_of_range);
1657 __ Set(eax, Immediate(Factory::nan_value())); 1673 __ Set(eax, Immediate(Factory::nan_value()));
1658 __ ret((argc + 1) * kPointerSize); 1674 __ ret((argc + 1) * kPointerSize);
1659 1675
1660 __ bind(&miss); 1676 __ bind(&miss);
1661 Object* obj = GenerateMissBranch(); 1677 Object* obj;
1662 if (obj->IsFailure()) return obj; 1678 { MaybeObject* maybe_obj = GenerateMissBranch();
1679 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
1680 }
1663 1681
1664 // Return the generated code. 1682 // Return the generated code.
1665 return GetCode(function); 1683 return GetCode(function);
1666 } 1684 }
1667 1685
1668 1686
1669 Object* CallStubCompiler::CompileStringCharAtCall(Object* object, 1687 MaybeObject* CallStubCompiler::CompileStringCharAtCall(
1670 JSObject* holder, 1688 Object* object,
1671 JSGlobalPropertyCell* cell, 1689 JSObject* holder,
1672 JSFunction* function, 1690 JSGlobalPropertyCell* cell,
1673 String* name) { 1691 JSFunction* function,
1692 String* name) {
1674 // ----------- S t a t e ------------- 1693 // ----------- S t a t e -------------
1675 // -- ecx : function name 1694 // -- ecx : function name
1676 // -- esp[0] : return address 1695 // -- esp[0] : return address
1677 // -- esp[(argc - n) * 4] : arg[n] (zero-based) 1696 // -- esp[(argc - n) * 4] : arg[n] (zero-based)
1678 // -- ... 1697 // -- ...
1679 // -- esp[(argc + 1) * 4] : receiver 1698 // -- esp[(argc + 1) * 4] : receiver
1680 // ----------------------------------- 1699 // -----------------------------------
1681 1700
1682 // If object is not a string, bail out to regular call. 1701 // If object is not a string, bail out to regular call.
1683 if (!object->IsString() || cell != NULL) return Heap::undefined_value(); 1702 if (!object->IsString() || cell != NULL) return Heap::undefined_value();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1723 __ ret((argc + 1) * kPointerSize); 1742 __ ret((argc + 1) * kPointerSize);
1724 1743
1725 ICRuntimeCallHelper call_helper; 1744 ICRuntimeCallHelper call_helper;
1726 char_at_generator.GenerateSlow(masm(), call_helper); 1745 char_at_generator.GenerateSlow(masm(), call_helper);
1727 1746
1728 __ bind(&index_out_of_range); 1747 __ bind(&index_out_of_range);
1729 __ Set(eax, Immediate(Factory::empty_string())); 1748 __ Set(eax, Immediate(Factory::empty_string()));
1730 __ ret((argc + 1) * kPointerSize); 1749 __ ret((argc + 1) * kPointerSize);
1731 1750
1732 __ bind(&miss); 1751 __ bind(&miss);
1733 Object* obj = GenerateMissBranch(); 1752 Object* obj;
1734 if (obj->IsFailure()) return obj; 1753 { MaybeObject* maybe_obj = GenerateMissBranch();
1754 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
1755 }
1735 1756
1736 // Return the generated code. 1757 // Return the generated code.
1737 return GetCode(function); 1758 return GetCode(function);
1738 } 1759 }
1739 1760
1740 1761
1741 Object* CallStubCompiler::CompileStringFromCharCodeCall( 1762 MaybeObject* CallStubCompiler::CompileStringFromCharCodeCall(
1742 Object* object, 1763 Object* object,
1743 JSObject* holder, 1764 JSObject* holder,
1744 JSGlobalPropertyCell* cell, 1765 JSGlobalPropertyCell* cell,
1745 JSFunction* function, 1766 JSFunction* function,
1746 String* name) { 1767 String* name) {
1747 // ----------- S t a t e ------------- 1768 // ----------- S t a t e -------------
1748 // -- ecx : function name 1769 // -- ecx : function name
1749 // -- esp[0] : return address 1770 // -- esp[0] : return address
1750 // -- esp[(argc - n) * 4] : arg[n] (zero-based) 1771 // -- esp[(argc - n) * 4] : arg[n] (zero-based)
1751 // -- ... 1772 // -- ...
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1796 ICRuntimeCallHelper call_helper; 1817 ICRuntimeCallHelper call_helper;
1797 char_from_code_generator.GenerateSlow(masm(), call_helper); 1818 char_from_code_generator.GenerateSlow(masm(), call_helper);
1798 1819
1799 // Tail call the full function. We do not have to patch the receiver 1820 // Tail call the full function. We do not have to patch the receiver
1800 // because the function makes no use of it. 1821 // because the function makes no use of it.
1801 __ bind(&slow); 1822 __ bind(&slow);
1802 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); 1823 __ InvokeFunction(function, arguments(), JUMP_FUNCTION);
1803 1824
1804 __ bind(&miss); 1825 __ bind(&miss);
1805 // ecx: function name. 1826 // ecx: function name.
1806 Object* obj = GenerateMissBranch(); 1827 Object* obj;
1807 if (obj->IsFailure()) return obj; 1828 { MaybeObject* maybe_obj = GenerateMissBranch();
1829 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
1830 }
1808 1831
1809 // Return the generated code. 1832 // Return the generated code.
1810 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name); 1833 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name);
1811 } 1834 }
1812 1835
1813 1836
1814 Object* CallStubCompiler::CompileMathFloorCall(Object* object, 1837 MaybeObject* CallStubCompiler::CompileMathFloorCall(Object* object,
1815 JSObject* holder, 1838 JSObject* holder,
1816 JSGlobalPropertyCell* cell, 1839 JSGlobalPropertyCell* cell,
1817 JSFunction* function, 1840 JSFunction* function,
1818 String* name) { 1841 String* name) {
1819 // ----------- S t a t e ------------- 1842 // ----------- S t a t e -------------
1820 // -- ecx : name 1843 // -- ecx : name
1821 // -- esp[0] : return address 1844 // -- esp[0] : return address
1822 // -- esp[(argc - n) * 4] : arg[n] (zero-based) 1845 // -- esp[(argc - n) * 4] : arg[n] (zero-based)
1823 // -- ... 1846 // -- ...
1824 // -- esp[(argc + 1) * 4] : receiver 1847 // -- esp[(argc + 1) * 4] : receiver
1825 // ----------------------------------- 1848 // -----------------------------------
1826 1849
1827 if (!CpuFeatures::IsSupported(SSE2)) return Heap::undefined_value(); 1850 if (!CpuFeatures::IsSupported(SSE2)) return Heap::undefined_value();
1828 CpuFeatures::Scope use_sse2(SSE2); 1851 CpuFeatures::Scope use_sse2(SSE2);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1921 __ mov(eax, Operand(esp, 1 * kPointerSize)); 1944 __ mov(eax, Operand(esp, 1 * kPointerSize));
1922 __ ret(2 * kPointerSize); 1945 __ ret(2 * kPointerSize);
1923 1946
1924 // Tail call the full function. We do not have to patch the receiver 1947 // Tail call the full function. We do not have to patch the receiver
1925 // because the function makes no use of it. 1948 // because the function makes no use of it.
1926 __ bind(&slow); 1949 __ bind(&slow);
1927 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); 1950 __ InvokeFunction(function, arguments(), JUMP_FUNCTION);
1928 1951
1929 __ bind(&miss); 1952 __ bind(&miss);
1930 // ecx: function name. 1953 // ecx: function name.
1931 Object* obj = GenerateMissBranch(); 1954 Object* obj;
1932 if (obj->IsFailure()) return obj; 1955 { MaybeObject* maybe_obj = GenerateMissBranch();
1956 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
1957 }
1933 1958
1934 // Return the generated code. 1959 // Return the generated code.
1935 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name); 1960 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name);
1936 } 1961 }
1937 1962
1938 1963
1939 Object* CallStubCompiler::CompileMathAbsCall(Object* object, 1964 MaybeObject* CallStubCompiler::CompileMathAbsCall(Object* object,
1940 JSObject* holder, 1965 JSObject* holder,
1941 JSGlobalPropertyCell* cell, 1966 JSGlobalPropertyCell* cell,
1942 JSFunction* function, 1967 JSFunction* function,
1943 String* name) { 1968 String* name) {
1944 // ----------- S t a t e ------------- 1969 // ----------- S t a t e -------------
1945 // -- ecx : name 1970 // -- ecx : name
1946 // -- esp[0] : return address 1971 // -- esp[0] : return address
1947 // -- esp[(argc - n) * 4] : arg[n] (zero-based) 1972 // -- esp[(argc - n) * 4] : arg[n] (zero-based)
1948 // -- ... 1973 // -- ...
1949 // -- esp[(argc + 1) * 4] : receiver 1974 // -- esp[(argc + 1) * 4] : receiver
1950 // ----------------------------------- 1975 // -----------------------------------
1951 1976
1952 const int argc = arguments().immediate(); 1977 const int argc = arguments().immediate();
1953 1978
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
2024 __ mov(FieldOperand(eax, HeapNumber::kMantissaOffset), ecx); 2049 __ mov(FieldOperand(eax, HeapNumber::kMantissaOffset), ecx);
2025 __ ret(2 * kPointerSize); 2050 __ ret(2 * kPointerSize);
2026 2051
2027 // Tail call the full function. We do not have to patch the receiver 2052 // Tail call the full function. We do not have to patch the receiver
2028 // because the function makes no use of it. 2053 // because the function makes no use of it.
2029 __ bind(&slow); 2054 __ bind(&slow);
2030 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); 2055 __ InvokeFunction(function, arguments(), JUMP_FUNCTION);
2031 2056
2032 __ bind(&miss); 2057 __ bind(&miss);
2033 // ecx: function name. 2058 // ecx: function name.
2034 Object* obj = GenerateMissBranch(); 2059 Object* obj;
2035 if (obj->IsFailure()) return obj; 2060 { MaybeObject* maybe_obj = GenerateMissBranch();
2061 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
2062 }
2036 2063
2037 // Return the generated code. 2064 // Return the generated code.
2038 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name); 2065 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name);
2039 } 2066 }
2040 2067
2041 2068
2042 Object* CallStubCompiler::CompileCallConstant(Object* object, 2069 MaybeObject* CallStubCompiler::CompileCallConstant(Object* object,
2043 JSObject* holder, 2070 JSObject* holder,
2044 JSFunction* function, 2071 JSFunction* function,
2045 String* name, 2072 String* name,
2046 CheckType check) { 2073 CheckType check) {
2047 // ----------- S t a t e ------------- 2074 // ----------- S t a t e -------------
2048 // -- ecx : name 2075 // -- ecx : name
2049 // -- esp[0] : return address 2076 // -- esp[0] : return address
2050 // -- esp[(argc - n) * 4] : arg[n] (zero-based) 2077 // -- esp[(argc - n) * 4] : arg[n] (zero-based)
2051 // -- ... 2078 // -- ...
2052 // -- esp[(argc + 1) * 4] : receiver 2079 // -- esp[(argc + 1) * 4] : receiver
2053 // ----------------------------------- 2080 // -----------------------------------
2054 2081
2055 SharedFunctionInfo* function_info = function->shared(); 2082 SharedFunctionInfo* function_info = function->shared();
2056 if (function_info->HasCustomCallGenerator()) { 2083 if (function_info->HasCustomCallGenerator()) {
2057 const int id = function_info->custom_call_generator_id(); 2084 const int id = function_info->custom_call_generator_id();
2058 Object* result = CompileCustomCall( 2085 MaybeObject* maybe_result = CompileCustomCall(
2059 id, object, holder, NULL, function, name); 2086 id, object, holder, NULL, function, name);
2087 Object* result;
2088 if (!maybe_result->ToObject(&result)) return maybe_result;
2060 // undefined means bail out to regular compiler. 2089 // undefined means bail out to regular compiler.
2061 if (!result->IsUndefined()) return result; 2090 if (!result->IsUndefined()) return result;
2062 } 2091 }
2063 2092
2064 Label miss_in_smi_check; 2093 Label miss_in_smi_check;
2065 2094
2066 GenerateNameCheck(name, &miss_in_smi_check); 2095 GenerateNameCheck(name, &miss_in_smi_check);
2067 2096
2068 // Get the receiver from the stack. 2097 // Get the receiver from the stack.
2069 const int argc = arguments().immediate(); 2098 const int argc = arguments().immediate();
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
2177 } else { 2206 } else {
2178 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); 2207 __ InvokeFunction(function, arguments(), JUMP_FUNCTION);
2179 } 2208 }
2180 2209
2181 // Handle call cache miss. 2210 // Handle call cache miss.
2182 __ bind(&miss); 2211 __ bind(&miss);
2183 if (depth != kInvalidProtoDepth) { 2212 if (depth != kInvalidProtoDepth) {
2184 FreeSpaceForFastApiCall(masm(), eax); 2213 FreeSpaceForFastApiCall(masm(), eax);
2185 } 2214 }
2186 __ bind(&miss_in_smi_check); 2215 __ bind(&miss_in_smi_check);
2187 Object* obj = GenerateMissBranch(); 2216 Object* obj;
2188 if (obj->IsFailure()) return obj; 2217 { MaybeObject* maybe_obj = GenerateMissBranch();
2218 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
2219 }
2189 2220
2190 // Return the generated code. 2221 // Return the generated code.
2191 return GetCode(function); 2222 return GetCode(function);
2192 } 2223 }
2193 2224
2194 2225
2195 Object* CallStubCompiler::CompileCallInterceptor(JSObject* object, 2226 MaybeObject* CallStubCompiler::CompileCallInterceptor(JSObject* object,
2196 JSObject* holder, 2227 JSObject* holder,
2197 String* name) { 2228 String* name) {
2198 // ----------- S t a t e ------------- 2229 // ----------- S t a t e -------------
2199 // -- ecx : name 2230 // -- ecx : name
2200 // -- esp[0] : return address 2231 // -- esp[0] : return address
2201 // -- esp[(argc - n) * 4] : arg[n] (zero-based) 2232 // -- esp[(argc - n) * 4] : arg[n] (zero-based)
2202 // -- ... 2233 // -- ...
2203 // -- esp[(argc + 1) * 4] : receiver 2234 // -- esp[(argc + 1) * 4] : receiver
2204 // ----------------------------------- 2235 // -----------------------------------
2205 Label miss; 2236 Label miss;
2206 2237
2207 GenerateNameCheck(name, &miss); 2238 GenerateNameCheck(name, &miss);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2242 __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset)); 2273 __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset));
2243 __ mov(Operand(esp, (argc + 1) * kPointerSize), edx); 2274 __ mov(Operand(esp, (argc + 1) * kPointerSize), edx);
2244 } 2275 }
2245 2276
2246 // Invoke the function. 2277 // Invoke the function.
2247 __ mov(edi, eax); 2278 __ mov(edi, eax);
2248 __ InvokeFunction(edi, arguments(), JUMP_FUNCTION); 2279 __ InvokeFunction(edi, arguments(), JUMP_FUNCTION);
2249 2280
2250 // Handle load cache miss. 2281 // Handle load cache miss.
2251 __ bind(&miss); 2282 __ bind(&miss);
2252 Object* obj = GenerateMissBranch(); 2283 Object* obj;
2253 if (obj->IsFailure()) return obj; 2284 { MaybeObject* maybe_obj = GenerateMissBranch();
2285 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
2286 }
2254 2287
2255 // Return the generated code. 2288 // Return the generated code.
2256 return GetCode(INTERCEPTOR, name); 2289 return GetCode(INTERCEPTOR, name);
2257 } 2290 }
2258 2291
2259 2292
2260 Object* CallStubCompiler::CompileCallGlobal(JSObject* object, 2293 MaybeObject* CallStubCompiler::CompileCallGlobal(JSObject* object,
2261 GlobalObject* holder, 2294 GlobalObject* holder,
2262 JSGlobalPropertyCell* cell, 2295 JSGlobalPropertyCell* cell,
2263 JSFunction* function, 2296 JSFunction* function,
2264 String* name) { 2297 String* name) {
2265 // ----------- S t a t e ------------- 2298 // ----------- S t a t e -------------
2266 // -- ecx : name 2299 // -- ecx : name
2267 // -- esp[0] : return address 2300 // -- esp[0] : return address
2268 // -- esp[(argc - n) * 4] : arg[n] (zero-based) 2301 // -- esp[(argc - n) * 4] : arg[n] (zero-based)
2269 // -- ... 2302 // -- ...
2270 // -- esp[(argc + 1) * 4] : receiver 2303 // -- esp[(argc + 1) * 4] : receiver
2271 // ----------------------------------- 2304 // -----------------------------------
2272 2305
2273 SharedFunctionInfo* function_info = function->shared(); 2306 SharedFunctionInfo* function_info = function->shared();
2274 if (function_info->HasCustomCallGenerator()) { 2307 if (function_info->HasCustomCallGenerator()) {
2275 const int id = function_info->custom_call_generator_id(); 2308 const int id = function_info->custom_call_generator_id();
2276 Object* result = CompileCustomCall( 2309 MaybeObject* maybe_result = CompileCustomCall(
2277 id, object, holder, cell, function, name); 2310 id, object, holder, cell, function, name);
2311 Object* result;
2312 if (!maybe_result->ToObject(&result)) return maybe_result;
2278 // undefined means bail out to regular compiler. 2313 // undefined means bail out to regular compiler.
2279 if (!result->IsUndefined()) return result; 2314 if (!result->IsUndefined()) return result;
2280 } 2315 }
2281 2316
2282 Label miss; 2317 Label miss;
2283 2318
2284 GenerateNameCheck(name, &miss); 2319 GenerateNameCheck(name, &miss);
2285 2320
2286 // Get the number of arguments. 2321 // Get the number of arguments.
2287 const int argc = arguments().immediate(); 2322 const int argc = arguments().immediate();
(...skipping 15 matching lines...) Expand all
2303 __ IncrementCounter(&Counters::call_global_inline, 1); 2338 __ IncrementCounter(&Counters::call_global_inline, 1);
2304 ASSERT(function->is_compiled()); 2339 ASSERT(function->is_compiled());
2305 Handle<Code> code(function->code()); 2340 Handle<Code> code(function->code());
2306 ParameterCount expected(function->shared()->formal_parameter_count()); 2341 ParameterCount expected(function->shared()->formal_parameter_count());
2307 __ InvokeCode(code, expected, arguments(), 2342 __ InvokeCode(code, expected, arguments(),
2308 RelocInfo::CODE_TARGET, JUMP_FUNCTION); 2343 RelocInfo::CODE_TARGET, JUMP_FUNCTION);
2309 2344
2310 // Handle call cache miss. 2345 // Handle call cache miss.
2311 __ bind(&miss); 2346 __ bind(&miss);
2312 __ IncrementCounter(&Counters::call_global_inline_miss, 1); 2347 __ IncrementCounter(&Counters::call_global_inline_miss, 1);
2313 Object* obj = GenerateMissBranch(); 2348 Object* obj;
2314 if (obj->IsFailure()) return obj; 2349 { MaybeObject* maybe_obj = GenerateMissBranch();
2350 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
2351 }
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* StoreStubCompiler::CompileStoreField(JSObject* object, 2358 MaybeObject* StoreStubCompiler::CompileStoreField(JSObject* object,
2322 int index, 2359 int index,
2323 Map* transition, 2360 Map* transition,
2324 String* name) { 2361 String* name) {
2325 // ----------- S t a t e ------------- 2362 // ----------- S t a t e -------------
2326 // -- eax : value 2363 // -- eax : value
2327 // -- ecx : name 2364 // -- ecx : name
2328 // -- edx : receiver 2365 // -- edx : receiver
2329 // -- esp[0] : return address 2366 // -- esp[0] : return address
2330 // ----------------------------------- 2367 // -----------------------------------
2331 Label miss; 2368 Label miss;
2332 2369
2333 // Generate store field code. Trashes the name register. 2370 // Generate store field code. Trashes the name register.
2334 GenerateStoreField(masm(), 2371 GenerateStoreField(masm(),
2335 object, 2372 object,
2336 index, 2373 index,
2337 transition, 2374 transition,
2338 edx, ecx, ebx, 2375 edx, ecx, ebx,
2339 &miss); 2376 &miss);
2340 2377
2341 // Handle store cache miss. 2378 // Handle store cache miss.
2342 __ bind(&miss); 2379 __ bind(&miss);
2343 __ mov(ecx, Immediate(Handle<String>(name))); // restore name 2380 __ mov(ecx, Immediate(Handle<String>(name))); // restore name
2344 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); 2381 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss));
2345 __ jmp(ic, RelocInfo::CODE_TARGET); 2382 __ jmp(ic, RelocInfo::CODE_TARGET);
2346 2383
2347 // Return the generated code. 2384 // Return the generated code.
2348 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name); 2385 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name);
2349 } 2386 }
2350 2387
2351 2388
2352 Object* StoreStubCompiler::CompileStoreCallback(JSObject* object, 2389 MaybeObject* StoreStubCompiler::CompileStoreCallback(JSObject* object,
2353 AccessorInfo* callback, 2390 AccessorInfo* callback,
2354 String* name) { 2391 String* name) {
2355 // ----------- S t a t e ------------- 2392 // ----------- S t a t e -------------
2356 // -- eax : value 2393 // -- eax : value
2357 // -- ecx : name 2394 // -- ecx : name
2358 // -- edx : receiver 2395 // -- edx : receiver
2359 // -- esp[0] : return address 2396 // -- esp[0] : return address
2360 // ----------------------------------- 2397 // -----------------------------------
2361 Label miss; 2398 Label miss;
2362 2399
2363 // Check that the object isn't a smi. 2400 // Check that the object isn't a smi.
2364 __ test(edx, Immediate(kSmiTagMask)); 2401 __ test(edx, Immediate(kSmiTagMask));
(...skipping 28 matching lines...) Expand all
2393 // Handle store cache miss. 2430 // Handle store cache miss.
2394 __ bind(&miss); 2431 __ bind(&miss);
2395 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); 2432 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss));
2396 __ jmp(ic, RelocInfo::CODE_TARGET); 2433 __ jmp(ic, RelocInfo::CODE_TARGET);
2397 2434
2398 // Return the generated code. 2435 // Return the generated code.
2399 return GetCode(CALLBACKS, name); 2436 return GetCode(CALLBACKS, name);
2400 } 2437 }
2401 2438
2402 2439
2403 Object* StoreStubCompiler::CompileStoreInterceptor(JSObject* receiver, 2440 MaybeObject* StoreStubCompiler::CompileStoreInterceptor(JSObject* receiver,
2404 String* name) { 2441 String* name) {
2405 // ----------- S t a t e ------------- 2442 // ----------- S t a t e -------------
2406 // -- eax : value 2443 // -- eax : value
2407 // -- ecx : name 2444 // -- ecx : name
2408 // -- edx : receiver 2445 // -- edx : receiver
2409 // -- esp[0] : return address 2446 // -- esp[0] : return address
2410 // ----------------------------------- 2447 // -----------------------------------
2411 Label miss; 2448 Label miss;
2412 2449
2413 // Check that the object isn't a smi. 2450 // Check that the object isn't a smi.
2414 __ test(edx, Immediate(kSmiTagMask)); 2451 __ test(edx, Immediate(kSmiTagMask));
(...skipping 27 matching lines...) Expand all
2442 // Handle store cache miss. 2479 // Handle store cache miss.
2443 __ bind(&miss); 2480 __ bind(&miss);
2444 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); 2481 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss));
2445 __ jmp(ic, RelocInfo::CODE_TARGET); 2482 __ jmp(ic, RelocInfo::CODE_TARGET);
2446 2483
2447 // Return the generated code. 2484 // Return the generated code.
2448 return GetCode(INTERCEPTOR, name); 2485 return GetCode(INTERCEPTOR, name);
2449 } 2486 }
2450 2487
2451 2488
2452 Object* StoreStubCompiler::CompileStoreGlobal(GlobalObject* object, 2489 MaybeObject* StoreStubCompiler::CompileStoreGlobal(GlobalObject* object,
2453 JSGlobalPropertyCell* cell, 2490 JSGlobalPropertyCell* cell,
2454 String* name) { 2491 String* name) {
2455 // ----------- S t a t e ------------- 2492 // ----------- S t a t e -------------
2456 // -- eax : value 2493 // -- eax : value
2457 // -- ecx : name 2494 // -- ecx : name
2458 // -- edx : receiver 2495 // -- edx : receiver
2459 // -- esp[0] : return address 2496 // -- esp[0] : return address
2460 // ----------------------------------- 2497 // -----------------------------------
2461 Label miss; 2498 Label miss;
2462 2499
2463 // Check that the map of the global has not changed. 2500 // Check that the map of the global has not changed.
2464 __ cmp(FieldOperand(edx, HeapObject::kMapOffset), 2501 __ cmp(FieldOperand(edx, HeapObject::kMapOffset),
(...skipping 12 matching lines...) Expand all
2477 __ bind(&miss); 2514 __ bind(&miss);
2478 __ IncrementCounter(&Counters::named_store_global_inline_miss, 1); 2515 __ IncrementCounter(&Counters::named_store_global_inline_miss, 1);
2479 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); 2516 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss));
2480 __ jmp(ic, RelocInfo::CODE_TARGET); 2517 __ jmp(ic, RelocInfo::CODE_TARGET);
2481 2518
2482 // Return the generated code. 2519 // Return the generated code.
2483 return GetCode(NORMAL, name); 2520 return GetCode(NORMAL, name);
2484 } 2521 }
2485 2522
2486 2523
2487 Object* KeyedStoreStubCompiler::CompileStoreField(JSObject* object, 2524 MaybeObject* KeyedStoreStubCompiler::CompileStoreField(JSObject* object,
2488 int index, 2525 int index,
2489 Map* transition, 2526 Map* transition,
2490 String* name) { 2527 String* name) {
2491 // ----------- S t a t e ------------- 2528 // ----------- S t a t e -------------
2492 // -- eax : value 2529 // -- eax : value
2493 // -- ecx : key 2530 // -- ecx : key
2494 // -- edx : receiver 2531 // -- edx : receiver
2495 // -- esp[0] : return address 2532 // -- esp[0] : return address
2496 // ----------------------------------- 2533 // -----------------------------------
2497 Label miss; 2534 Label miss;
2498 2535
2499 __ IncrementCounter(&Counters::keyed_store_field, 1); 2536 __ IncrementCounter(&Counters::keyed_store_field, 1);
2500 2537
(...skipping 13 matching lines...) Expand all
2514 __ bind(&miss); 2551 __ bind(&miss);
2515 __ DecrementCounter(&Counters::keyed_store_field, 1); 2552 __ DecrementCounter(&Counters::keyed_store_field, 1);
2516 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Miss)); 2553 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Miss));
2517 __ jmp(ic, RelocInfo::CODE_TARGET); 2554 __ jmp(ic, RelocInfo::CODE_TARGET);
2518 2555
2519 // Return the generated code. 2556 // Return the generated code.
2520 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name); 2557 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name);
2521 } 2558 }
2522 2559
2523 2560
2524 Object* LoadStubCompiler::CompileLoadNonexistent(String* name, 2561 MaybeObject* LoadStubCompiler::CompileLoadNonexistent(String* name,
2525 JSObject* object, 2562 JSObject* object,
2526 JSObject* last) { 2563 JSObject* last) {
2527 // ----------- S t a t e ------------- 2564 // ----------- S t a t e -------------
2528 // -- eax : receiver 2565 // -- eax : receiver
2529 // -- ecx : name 2566 // -- ecx : name
2530 // -- esp[0] : return address 2567 // -- esp[0] : return address
2531 // ----------------------------------- 2568 // -----------------------------------
2532 Label miss; 2569 Label miss;
2533 2570
2534 // Check that the receiver isn't a smi. 2571 // Check that the receiver isn't a smi.
2535 __ test(eax, Immediate(kSmiTagMask)); 2572 __ test(eax, Immediate(kSmiTagMask));
2536 __ j(zero, &miss, not_taken); 2573 __ j(zero, &miss, not_taken);
2537 2574
2538 ASSERT(last->IsGlobalObject() || last->HasFastProperties()); 2575 ASSERT(last->IsGlobalObject() || last->HasFastProperties());
2539 2576
2540 // Check the maps of the full prototype chain. Also check that 2577 // Check the maps of the full prototype chain. Also check that
2541 // global property cells up to (but not including) the last object 2578 // global property cells up to (but not including) the last object
2542 // in the prototype chain are empty. 2579 // in the prototype chain are empty.
2543 CheckPrototypes(object, eax, last, ebx, edx, edi, name, &miss); 2580 CheckPrototypes(object, eax, last, ebx, edx, edi, name, &miss);
2544 2581
2545 // If the last object in the prototype chain is a global object, 2582 // If the last object in the prototype chain is a global object,
2546 // check that the global property cell is empty. 2583 // check that the global property cell is empty.
2547 if (last->IsGlobalObject()) { 2584 if (last->IsGlobalObject()) {
2548 Object* cell = GenerateCheckPropertyCell(masm(), 2585 MaybeObject* cell = GenerateCheckPropertyCell(masm(),
2549 GlobalObject::cast(last), 2586 GlobalObject::cast(last),
2550 name, 2587 name,
2551 edx, 2588 edx,
2552 &miss); 2589 &miss);
2553 if (cell->IsFailure()) { 2590 if (cell->IsFailure()) {
2554 miss.Unuse(); 2591 miss.Unuse();
2555 return cell; 2592 return cell;
2556 } 2593 }
2557 } 2594 }
2558 2595
2559 // Return undefined if maps of the full prototype chain are still the 2596 // Return undefined if maps of the full prototype chain are still the
2560 // same and no global property with this name contains a value. 2597 // same and no global property with this name contains a value.
2561 __ mov(eax, Factory::undefined_value()); 2598 __ mov(eax, Factory::undefined_value());
2562 __ ret(0); 2599 __ ret(0);
2563 2600
2564 __ bind(&miss); 2601 __ bind(&miss);
2565 GenerateLoadMiss(masm(), Code::LOAD_IC); 2602 GenerateLoadMiss(masm(), Code::LOAD_IC);
2566 2603
2567 // Return the generated code. 2604 // Return the generated code.
2568 return GetCode(NONEXISTENT, Heap::empty_string()); 2605 return GetCode(NONEXISTENT, Heap::empty_string());
2569 } 2606 }
2570 2607
2571 2608
2572 Object* LoadStubCompiler::CompileLoadField(JSObject* object, 2609 MaybeObject* LoadStubCompiler::CompileLoadField(JSObject* object,
2573 JSObject* holder, 2610 JSObject* holder,
2574 int index, 2611 int index,
2575 String* name) { 2612 String* name) {
2576 // ----------- S t a t e ------------- 2613 // ----------- S t a t e -------------
2577 // -- eax : receiver 2614 // -- eax : receiver
2578 // -- ecx : name 2615 // -- ecx : name
2579 // -- esp[0] : return address 2616 // -- esp[0] : return address
2580 // ----------------------------------- 2617 // -----------------------------------
2581 Label miss; 2618 Label miss;
2582 2619
2583 GenerateLoadField(object, holder, eax, ebx, edx, edi, index, name, &miss); 2620 GenerateLoadField(object, holder, eax, ebx, edx, edi, index, name, &miss);
2584 __ bind(&miss); 2621 __ bind(&miss);
2585 GenerateLoadMiss(masm(), Code::LOAD_IC); 2622 GenerateLoadMiss(masm(), Code::LOAD_IC);
2586 2623
2587 // Return the generated code. 2624 // Return the generated code.
2588 return GetCode(FIELD, name); 2625 return GetCode(FIELD, name);
2589 } 2626 }
2590 2627
2591 2628
2592 Object* LoadStubCompiler::CompileLoadCallback(String* name, 2629 MaybeObject* LoadStubCompiler::CompileLoadCallback(String* name,
2593 JSObject* object, 2630 JSObject* object,
2594 JSObject* holder, 2631 JSObject* holder,
2595 AccessorInfo* callback) { 2632 AccessorInfo* callback) {
2596 // ----------- S t a t e ------------- 2633 // ----------- S t a t e -------------
2597 // -- eax : receiver 2634 // -- eax : receiver
2598 // -- ecx : name 2635 // -- ecx : name
2599 // -- esp[0] : return address 2636 // -- esp[0] : return address
2600 // ----------------------------------- 2637 // -----------------------------------
2601 Label miss; 2638 Label miss;
2602 2639
2603 Failure* failure = Failure::InternalError(); 2640 Failure* failure = Failure::InternalError();
2604 bool success = GenerateLoadCallback(object, holder, eax, ecx, ebx, edx, edi, 2641 bool success = GenerateLoadCallback(object, holder, eax, ecx, ebx, edx, edi,
2605 callback, name, &miss, &failure); 2642 callback, name, &miss, &failure);
2606 if (!success) { 2643 if (!success) {
2607 miss.Unuse(); 2644 miss.Unuse();
2608 return failure; 2645 return failure;
2609 } 2646 }
2610 2647
2611 __ bind(&miss); 2648 __ bind(&miss);
2612 GenerateLoadMiss(masm(), Code::LOAD_IC); 2649 GenerateLoadMiss(masm(), Code::LOAD_IC);
2613 2650
2614 // Return the generated code. 2651 // Return the generated code.
2615 return GetCode(CALLBACKS, name); 2652 return GetCode(CALLBACKS, name);
2616 } 2653 }
2617 2654
2618 2655
2619 Object* LoadStubCompiler::CompileLoadConstant(JSObject* object, 2656 MaybeObject* LoadStubCompiler::CompileLoadConstant(JSObject* object,
2620 JSObject* holder, 2657 JSObject* holder,
2621 Object* value, 2658 Object* value,
2622 String* name) { 2659 String* name) {
2623 // ----------- S t a t e ------------- 2660 // ----------- S t a t e -------------
2624 // -- eax : receiver 2661 // -- eax : receiver
2625 // -- ecx : name 2662 // -- ecx : name
2626 // -- esp[0] : return address 2663 // -- esp[0] : return address
2627 // ----------------------------------- 2664 // -----------------------------------
2628 Label miss; 2665 Label miss;
2629 2666
2630 GenerateLoadConstant(object, holder, eax, ebx, edx, edi, value, name, &miss); 2667 GenerateLoadConstant(object, holder, eax, ebx, edx, edi, value, name, &miss);
2631 __ bind(&miss); 2668 __ bind(&miss);
2632 GenerateLoadMiss(masm(), Code::LOAD_IC); 2669 GenerateLoadMiss(masm(), Code::LOAD_IC);
2633 2670
2634 // Return the generated code. 2671 // Return the generated code.
2635 return GetCode(CONSTANT_FUNCTION, name); 2672 return GetCode(CONSTANT_FUNCTION, name);
2636 } 2673 }
2637 2674
2638 2675
2639 Object* LoadStubCompiler::CompileLoadInterceptor(JSObject* receiver, 2676 MaybeObject* LoadStubCompiler::CompileLoadInterceptor(JSObject* receiver,
2640 JSObject* holder, 2677 JSObject* holder,
2641 String* name) { 2678 String* name) {
2642 // ----------- S t a t e ------------- 2679 // ----------- S t a t e -------------
2643 // -- eax : receiver 2680 // -- eax : receiver
2644 // -- ecx : name 2681 // -- ecx : name
2645 // -- esp[0] : return address 2682 // -- esp[0] : return address
2646 // ----------------------------------- 2683 // -----------------------------------
2647 Label miss; 2684 Label miss;
2648 2685
2649 LookupResult lookup; 2686 LookupResult lookup;
2650 LookupPostInterceptor(holder, name, &lookup); 2687 LookupPostInterceptor(holder, name, &lookup);
2651 2688
(...skipping 11 matching lines...) Expand all
2663 &miss); 2700 &miss);
2664 2701
2665 __ bind(&miss); 2702 __ bind(&miss);
2666 GenerateLoadMiss(masm(), Code::LOAD_IC); 2703 GenerateLoadMiss(masm(), Code::LOAD_IC);
2667 2704
2668 // Return the generated code. 2705 // Return the generated code.
2669 return GetCode(INTERCEPTOR, name); 2706 return GetCode(INTERCEPTOR, name);
2670 } 2707 }
2671 2708
2672 2709
2673 Object* LoadStubCompiler::CompileLoadGlobal(JSObject* object, 2710 MaybeObject* LoadStubCompiler::CompileLoadGlobal(JSObject* object,
2674 GlobalObject* holder, 2711 GlobalObject* holder,
2675 JSGlobalPropertyCell* cell, 2712 JSGlobalPropertyCell* cell,
2676 String* name, 2713 String* name,
2677 bool is_dont_delete) { 2714 bool is_dont_delete) {
2678 // ----------- S t a t e ------------- 2715 // ----------- S t a t e -------------
2679 // -- eax : receiver 2716 // -- eax : receiver
2680 // -- ecx : name 2717 // -- ecx : name
2681 // -- esp[0] : return address 2718 // -- esp[0] : return address
2682 // ----------------------------------- 2719 // -----------------------------------
2683 Label miss; 2720 Label miss;
2684 2721
2685 // If the object is the holder then we know that it's a global 2722 // If the object is the holder then we know that it's a global
2686 // object which can only happen for contextual loads. In this case, 2723 // object which can only happen for contextual loads. In this case,
2687 // the receiver cannot be a smi. 2724 // the receiver cannot be a smi.
(...skipping 24 matching lines...) Expand all
2712 2749
2713 __ bind(&miss); 2750 __ bind(&miss);
2714 __ IncrementCounter(&Counters::named_load_global_stub_miss, 1); 2751 __ IncrementCounter(&Counters::named_load_global_stub_miss, 1);
2715 GenerateLoadMiss(masm(), Code::LOAD_IC); 2752 GenerateLoadMiss(masm(), Code::LOAD_IC);
2716 2753
2717 // Return the generated code. 2754 // Return the generated code.
2718 return GetCode(NORMAL, name); 2755 return GetCode(NORMAL, name);
2719 } 2756 }
2720 2757
2721 2758
2722 Object* KeyedLoadStubCompiler::CompileLoadField(String* name, 2759 MaybeObject* KeyedLoadStubCompiler::CompileLoadField(String* name,
2723 JSObject* receiver, 2760 JSObject* receiver,
2724 JSObject* holder, 2761 JSObject* holder,
2725 int index) { 2762 int index) {
2726 // ----------- S t a t e ------------- 2763 // ----------- S t a t e -------------
2727 // -- eax : key 2764 // -- eax : key
2728 // -- edx : receiver 2765 // -- edx : receiver
2729 // -- esp[0] : return address 2766 // -- esp[0] : return address
2730 // ----------------------------------- 2767 // -----------------------------------
2731 Label miss; 2768 Label miss;
2732 2769
2733 __ IncrementCounter(&Counters::keyed_load_field, 1); 2770 __ IncrementCounter(&Counters::keyed_load_field, 1);
2734 2771
2735 // Check that the name has not changed. 2772 // Check that the name has not changed.
2736 __ cmp(Operand(eax), Immediate(Handle<String>(name))); 2773 __ cmp(Operand(eax), Immediate(Handle<String>(name)));
2737 __ j(not_equal, &miss, not_taken); 2774 __ j(not_equal, &miss, not_taken);
2738 2775
2739 GenerateLoadField(receiver, holder, edx, ebx, ecx, edi, index, name, &miss); 2776 GenerateLoadField(receiver, holder, edx, ebx, ecx, edi, index, name, &miss);
2740 2777
2741 __ bind(&miss); 2778 __ bind(&miss);
2742 __ DecrementCounter(&Counters::keyed_load_field, 1); 2779 __ DecrementCounter(&Counters::keyed_load_field, 1);
2743 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); 2780 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
2744 2781
2745 // Return the generated code. 2782 // Return the generated code.
2746 return GetCode(FIELD, name); 2783 return GetCode(FIELD, name);
2747 } 2784 }
2748 2785
2749 2786
2750 Object* KeyedLoadStubCompiler::CompileLoadCallback(String* name, 2787 MaybeObject* KeyedLoadStubCompiler::CompileLoadCallback(
2751 JSObject* receiver, 2788 String* name,
2752 JSObject* holder, 2789 JSObject* receiver,
2753 AccessorInfo* callback) { 2790 JSObject* holder,
2791 AccessorInfo* callback) {
2754 // ----------- S t a t e ------------- 2792 // ----------- S t a t e -------------
2755 // -- eax : key 2793 // -- eax : key
2756 // -- edx : receiver 2794 // -- edx : receiver
2757 // -- esp[0] : return address 2795 // -- esp[0] : return address
2758 // ----------------------------------- 2796 // -----------------------------------
2759 Label miss; 2797 Label miss;
2760 2798
2761 __ IncrementCounter(&Counters::keyed_load_callback, 1); 2799 __ IncrementCounter(&Counters::keyed_load_callback, 1);
2762 2800
2763 // Check that the name has not changed. 2801 // Check that the name has not changed.
(...skipping 11 matching lines...) Expand all
2775 __ bind(&miss); 2813 __ bind(&miss);
2776 2814
2777 __ DecrementCounter(&Counters::keyed_load_callback, 1); 2815 __ DecrementCounter(&Counters::keyed_load_callback, 1);
2778 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); 2816 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
2779 2817
2780 // Return the generated code. 2818 // Return the generated code.
2781 return GetCode(CALLBACKS, name); 2819 return GetCode(CALLBACKS, name);
2782 } 2820 }
2783 2821
2784 2822
2785 Object* KeyedLoadStubCompiler::CompileLoadConstant(String* name, 2823 MaybeObject* KeyedLoadStubCompiler::CompileLoadConstant(String* name,
2786 JSObject* receiver, 2824 JSObject* receiver,
2787 JSObject* holder, 2825 JSObject* holder,
2788 Object* value) { 2826 Object* value) {
2789 // ----------- S t a t e ------------- 2827 // ----------- S t a t e -------------
2790 // -- eax : key 2828 // -- eax : key
2791 // -- edx : receiver 2829 // -- edx : receiver
2792 // -- esp[0] : return address 2830 // -- esp[0] : return address
2793 // ----------------------------------- 2831 // -----------------------------------
2794 Label miss; 2832 Label miss;
2795 2833
2796 __ IncrementCounter(&Counters::keyed_load_constant_function, 1); 2834 __ IncrementCounter(&Counters::keyed_load_constant_function, 1);
2797 2835
2798 // Check that the name has not changed. 2836 // Check that the name has not changed.
2799 __ cmp(Operand(eax), Immediate(Handle<String>(name))); 2837 __ cmp(Operand(eax), Immediate(Handle<String>(name)));
2800 __ j(not_equal, &miss, not_taken); 2838 __ j(not_equal, &miss, not_taken);
2801 2839
2802 GenerateLoadConstant(receiver, holder, edx, ebx, ecx, edi, 2840 GenerateLoadConstant(receiver, holder, edx, ebx, ecx, edi,
2803 value, name, &miss); 2841 value, name, &miss);
2804 __ bind(&miss); 2842 __ bind(&miss);
2805 __ DecrementCounter(&Counters::keyed_load_constant_function, 1); 2843 __ DecrementCounter(&Counters::keyed_load_constant_function, 1);
2806 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); 2844 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
2807 2845
2808 // Return the generated code. 2846 // Return the generated code.
2809 return GetCode(CONSTANT_FUNCTION, name); 2847 return GetCode(CONSTANT_FUNCTION, name);
2810 } 2848 }
2811 2849
2812 2850
2813 Object* KeyedLoadStubCompiler::CompileLoadInterceptor(JSObject* receiver, 2851 MaybeObject* KeyedLoadStubCompiler::CompileLoadInterceptor(JSObject* receiver,
2814 JSObject* holder, 2852 JSObject* holder,
2815 String* name) { 2853 String* name) {
2816 // ----------- S t a t e ------------- 2854 // ----------- S t a t e -------------
2817 // -- eax : key 2855 // -- eax : key
2818 // -- edx : receiver 2856 // -- edx : receiver
2819 // -- esp[0] : return address 2857 // -- esp[0] : return address
2820 // ----------------------------------- 2858 // -----------------------------------
2821 Label miss; 2859 Label miss;
2822 2860
2823 __ IncrementCounter(&Counters::keyed_load_interceptor, 1); 2861 __ IncrementCounter(&Counters::keyed_load_interceptor, 1);
2824 2862
2825 // Check that the name has not changed. 2863 // Check that the name has not changed.
(...skipping 14 matching lines...) Expand all
2840 &miss); 2878 &miss);
2841 __ bind(&miss); 2879 __ bind(&miss);
2842 __ DecrementCounter(&Counters::keyed_load_interceptor, 1); 2880 __ DecrementCounter(&Counters::keyed_load_interceptor, 1);
2843 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); 2881 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
2844 2882
2845 // Return the generated code. 2883 // Return the generated code.
2846 return GetCode(INTERCEPTOR, name); 2884 return GetCode(INTERCEPTOR, name);
2847 } 2885 }
2848 2886
2849 2887
2850 2888 MaybeObject* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) {
2851
2852 Object* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) {
2853 // ----------- S t a t e ------------- 2889 // ----------- S t a t e -------------
2854 // -- eax : key 2890 // -- eax : key
2855 // -- edx : receiver 2891 // -- edx : receiver
2856 // -- esp[0] : return address 2892 // -- esp[0] : return address
2857 // ----------------------------------- 2893 // -----------------------------------
2858 Label miss; 2894 Label miss;
2859 2895
2860 __ IncrementCounter(&Counters::keyed_load_array_length, 1); 2896 __ IncrementCounter(&Counters::keyed_load_array_length, 1);
2861 2897
2862 // Check that the name has not changed. 2898 // Check that the name has not changed.
2863 __ cmp(Operand(eax), Immediate(Handle<String>(name))); 2899 __ cmp(Operand(eax), Immediate(Handle<String>(name)));
2864 __ j(not_equal, &miss, not_taken); 2900 __ j(not_equal, &miss, not_taken);
2865 2901
2866 GenerateLoadArrayLength(masm(), edx, ecx, &miss); 2902 GenerateLoadArrayLength(masm(), edx, ecx, &miss);
2867 __ bind(&miss); 2903 __ bind(&miss);
2868 __ DecrementCounter(&Counters::keyed_load_array_length, 1); 2904 __ DecrementCounter(&Counters::keyed_load_array_length, 1);
2869 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); 2905 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
2870 2906
2871 // Return the generated code. 2907 // Return the generated code.
2872 return GetCode(CALLBACKS, name); 2908 return GetCode(CALLBACKS, name);
2873 } 2909 }
2874 2910
2875 2911
2876 Object* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) { 2912 MaybeObject* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) {
2877 // ----------- S t a t e ------------- 2913 // ----------- S t a t e -------------
2878 // -- eax : key 2914 // -- eax : key
2879 // -- edx : receiver 2915 // -- edx : receiver
2880 // -- esp[0] : return address 2916 // -- esp[0] : return address
2881 // ----------------------------------- 2917 // -----------------------------------
2882 Label miss; 2918 Label miss;
2883 2919
2884 __ IncrementCounter(&Counters::keyed_load_string_length, 1); 2920 __ IncrementCounter(&Counters::keyed_load_string_length, 1);
2885 2921
2886 // Check that the name has not changed. 2922 // Check that the name has not changed.
2887 __ cmp(Operand(eax), Immediate(Handle<String>(name))); 2923 __ cmp(Operand(eax), Immediate(Handle<String>(name)));
2888 __ j(not_equal, &miss, not_taken); 2924 __ j(not_equal, &miss, not_taken);
2889 2925
2890 GenerateLoadStringLength(masm(), edx, ecx, ebx, &miss); 2926 GenerateLoadStringLength(masm(), edx, ecx, ebx, &miss);
2891 __ bind(&miss); 2927 __ bind(&miss);
2892 __ DecrementCounter(&Counters::keyed_load_string_length, 1); 2928 __ DecrementCounter(&Counters::keyed_load_string_length, 1);
2893 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); 2929 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
2894 2930
2895 // Return the generated code. 2931 // Return the generated code.
2896 return GetCode(CALLBACKS, name); 2932 return GetCode(CALLBACKS, name);
2897 } 2933 }
2898 2934
2899 2935
2900 Object* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) { 2936 MaybeObject* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) {
2901 // ----------- S t a t e ------------- 2937 // ----------- S t a t e -------------
2902 // -- eax : key 2938 // -- eax : key
2903 // -- edx : receiver 2939 // -- edx : receiver
2904 // -- esp[0] : return address 2940 // -- esp[0] : return address
2905 // ----------------------------------- 2941 // -----------------------------------
2906 Label miss; 2942 Label miss;
2907 2943
2908 __ IncrementCounter(&Counters::keyed_load_function_prototype, 1); 2944 __ IncrementCounter(&Counters::keyed_load_function_prototype, 1);
2909 2945
2910 // Check that the name has not changed. 2946 // Check that the name has not changed.
2911 __ cmp(Operand(eax), Immediate(Handle<String>(name))); 2947 __ cmp(Operand(eax), Immediate(Handle<String>(name)));
2912 __ j(not_equal, &miss, not_taken); 2948 __ j(not_equal, &miss, not_taken);
2913 2949
2914 GenerateLoadFunctionPrototype(masm(), edx, ecx, ebx, &miss); 2950 GenerateLoadFunctionPrototype(masm(), edx, ecx, ebx, &miss);
2915 __ bind(&miss); 2951 __ bind(&miss);
2916 __ DecrementCounter(&Counters::keyed_load_function_prototype, 1); 2952 __ DecrementCounter(&Counters::keyed_load_function_prototype, 1);
2917 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); 2953 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
2918 2954
2919 // Return the generated code. 2955 // Return the generated code.
2920 return GetCode(CALLBACKS, name); 2956 return GetCode(CALLBACKS, name);
2921 } 2957 }
2922 2958
2923 2959
2924 // Specialized stub for constructing objects from functions which only have only 2960 // Specialized stub for constructing objects from functions which only have only
2925 // simple assignments of the form this.x = ...; in their body. 2961 // simple assignments of the form this.x = ...; in their body.
2926 Object* ConstructStubCompiler::CompileConstructStub( 2962 MaybeObject* ConstructStubCompiler::CompileConstructStub(
2927 SharedFunctionInfo* shared) { 2963 SharedFunctionInfo* shared) {
2928 // ----------- S t a t e ------------- 2964 // ----------- S t a t e -------------
2929 // -- eax : argc 2965 // -- eax : argc
2930 // -- edi : constructor 2966 // -- edi : constructor
2931 // -- esp[0] : return address 2967 // -- esp[0] : return address
2932 // -- esp[4] : last argument 2968 // -- esp[4] : last argument
2933 // ----------------------------------- 2969 // -----------------------------------
2934 Label generic_stub_call; 2970 Label generic_stub_call;
2935 #ifdef ENABLE_DEBUGGER_SUPPORT 2971 #ifdef ENABLE_DEBUGGER_SUPPORT
2936 // Check to see whether there are any break points in the function code. If 2972 // Check to see whether there are any break points in the function code. If
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
3056 // Return the generated code. 3092 // Return the generated code.
3057 return GetCode(); 3093 return GetCode();
3058 } 3094 }
3059 3095
3060 3096
3061 #undef __ 3097 #undef __
3062 3098
3063 } } // namespace v8::internal 3099 } } // namespace v8::internal
3064 3100
3065 #endif // V8_TARGET_ARCH_IA32 3101 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/regexp-macro-assembler-ia32.cc ('k') | src/ic.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698