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

Side by Side Diff: src/ic.cc

Issue 3473024: [Isolates] More handle improvements: (Closed)
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
« no previous file with comments | « src/handles-inl.h ('k') | src/runtime.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 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 Object* code = isolate()->stub_cache()->ComputeCallMegamorphic( 729 Object* code = isolate()->stub_cache()->ComputeCallMegamorphic(
730 argc, in_loop, Code::KEYED_CALL_IC); 730 argc, in_loop, Code::KEYED_CALL_IC);
731 if (!code->IsFailure()) { 731 if (!code->IsFailure()) {
732 set_target(Code::cast(code)); 732 set_target(Code::cast(code));
733 #ifdef DEBUG 733 #ifdef DEBUG
734 TraceIC( 734 TraceIC(
735 "KeyedCallIC", key, state, target(), in_loop ? " (in-loop)" : ""); 735 "KeyedCallIC", key, state, target(), in_loop ? " (in-loop)" : "");
736 #endif 736 #endif
737 } 737 }
738 } 738 }
739 Heap* heap = HEAP; 739 Object* result = Runtime::GetObjectProperty(isolate(), object, key);
740 Object* result = Runtime::GetObjectProperty(heap, object, key);
741 if (result->IsJSFunction()) return result; 740 if (result->IsJSFunction()) return result;
742 result = TryCallAsFunction(result); 741 result = TryCallAsFunction(result);
743 return result->IsJSFunction() ? 742 return result->IsJSFunction() ?
744 result : TypeError("property_not_function", object, key); 743 result : TypeError("property_not_function", object, key);
745 } 744 }
746 745
747 746
748 #ifdef DEBUG 747 #ifdef DEBUG
749 #define TRACE_IC_NAMED(msg, name) \ 748 #define TRACE_IC_NAMED(msg, name) \
750 if (FLAG_trace_ic) PrintF(msg, *(name)->ToCString()) 749 if (FLAG_trace_ic) PrintF(msg, *(name)->ToCString())
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 } 1085 }
1087 } 1086 }
1088 1087
1089 // Check if the name is trivially convertible to an index and get 1088 // Check if the name is trivially convertible to an index and get
1090 // the element or char if so. 1089 // the element or char if so.
1091 uint32_t index = 0; 1090 uint32_t index = 0;
1092 if (name->AsArrayIndex(&index)) { 1091 if (name->AsArrayIndex(&index)) {
1093 HandleScope scope; 1092 HandleScope scope;
1094 // Rewrite to the generic keyed load stub. 1093 // Rewrite to the generic keyed load stub.
1095 if (FLAG_use_ic) set_target(generic_stub()); 1094 if (FLAG_use_ic) set_target(generic_stub());
1096 return Runtime::GetElementOrCharAt(HEAP, object, index); 1095 return Runtime::GetElementOrCharAt(isolate(), object, index);
1097 } 1096 }
1098 1097
1099 // Named lookup. 1098 // Named lookup.
1100 LookupResult lookup; 1099 LookupResult lookup;
1101 LookupForRead(*object, *name, &lookup); 1100 LookupForRead(*object, *name, &lookup);
1102 1101
1103 // If we did not find a property, check if we need to throw an exception. 1102 // If we did not find a property, check if we need to throw an exception.
1104 if (!lookup.IsProperty()) { 1103 if (!lookup.IsProperty()) {
1105 if (FLAG_strict || IsContextual(object)) { 1104 if (FLAG_strict || IsContextual(object)) {
1106 return ReferenceError("not_defined", name); 1105 return ReferenceError("not_defined", name);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 if (object->IsJSObject() && 1150 if (object->IsJSObject() &&
1152 !object->IsJSValue() && 1151 !object->IsJSValue() &&
1153 !JSObject::cast(*object)->HasIndexedInterceptor() && 1152 !JSObject::cast(*object)->HasIndexedInterceptor() &&
1154 JSObject::cast(*object)->HasFastElements()) { 1153 JSObject::cast(*object)->HasFastElements()) {
1155 Map* map = JSObject::cast(*object)->map(); 1154 Map* map = JSObject::cast(*object)->map();
1156 PatchInlinedLoad(address(), map); 1155 PatchInlinedLoad(address(), map);
1157 } 1156 }
1158 } 1157 }
1159 1158
1160 // Get the property. 1159 // Get the property.
1161 return Runtime::GetObjectProperty(HEAP, object, key); 1160 return Runtime::GetObjectProperty(isolate(), object, key);
1162 } 1161 }
1163 1162
1164 1163
1165 void KeyedLoadIC::UpdateCaches(LookupResult* lookup, State state, 1164 void KeyedLoadIC::UpdateCaches(LookupResult* lookup, State state,
1166 Handle<Object> object, Handle<String> name) { 1165 Handle<Object> object, Handle<String> name) {
1167 // Bail out if we didn't find a result. 1166 // Bail out if we didn't find a result.
1168 if (!lookup->IsProperty() || !lookup->IsCacheable()) return; 1167 if (!lookup->IsProperty() || !lookup->IsCacheable()) return;
1169 1168
1170 if (!object->IsJSObject()) return; 1169 if (!object->IsJSObject()) return;
1171 Handle<JSObject> receiver = Handle<JSObject>::cast(object); 1170 Handle<JSObject> receiver = Handle<JSObject>::cast(object);
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
1526 if (object->IsJSObject()) { 1525 if (object->IsJSObject()) {
1527 Handle<JSObject> receiver = Handle<JSObject>::cast(object); 1526 Handle<JSObject> receiver = Handle<JSObject>::cast(object);
1528 if (receiver->HasExternalArrayElements()) { 1527 if (receiver->HasExternalArrayElements()) {
1529 stub = external_array_stub(receiver->GetElementsKind()); 1528 stub = external_array_stub(receiver->GetElementsKind());
1530 } 1529 }
1531 } 1530 }
1532 set_target(stub); 1531 set_target(stub);
1533 } 1532 }
1534 1533
1535 // Set the property. 1534 // Set the property.
1536 return Runtime::SetObjectProperty(HEAP, object, key, value, NONE); 1535 return Runtime::SetObjectProperty(isolate(), object, key, value, NONE);
1537 } 1536 }
1538 1537
1539 1538
1540 void KeyedStoreIC::UpdateCaches(LookupResult* lookup, 1539 void KeyedStoreIC::UpdateCaches(LookupResult* lookup,
1541 State state, 1540 State state,
1542 Handle<JSObject> receiver, 1541 Handle<JSObject> receiver,
1543 Handle<String> name, 1542 Handle<String> name,
1544 Handle<Object> value) { 1543 Handle<Object> value) {
1545 // Skip JSGlobalProxy. 1544 // Skip JSGlobalProxy.
1546 if (receiver->IsJSGlobalProxy()) return; 1545 if (receiver->IsJSGlobalProxy()) return;
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
1918 #undef ADDR 1917 #undef ADDR
1919 }; 1918 };
1920 1919
1921 1920
1922 Address IC::AddressFromUtilityId(IC::UtilityId id) { 1921 Address IC::AddressFromUtilityId(IC::UtilityId id) {
1923 return IC_utilities[id]; 1922 return IC_utilities[id];
1924 } 1923 }
1925 1924
1926 1925
1927 } } // namespace v8::internal 1926 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/handles-inl.h ('k') | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698