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

Side by Side Diff: src/ic.cc

Issue 8341009: Make the GC aware of JSReceiver pointers in LookupResults. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Inlined LookupResult constructor and destructor. Created 9 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/stub-cache-ia32.cc ('k') | src/isolate.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 if (result->IsJSFunction()) return result; 476 if (result->IsJSFunction()) return result;
477 477
478 // Try to find a suitable function delegate for the object at hand. 478 // Try to find a suitable function delegate for the object at hand.
479 result = TryCallAsFunction(result); 479 result = TryCallAsFunction(result);
480 if (result->IsJSFunction()) return result; 480 if (result->IsJSFunction()) return result;
481 481
482 // Otherwise, it will fail in the lookup step. 482 // Otherwise, it will fail in the lookup step.
483 } 483 }
484 484
485 // Lookup the property in the object. 485 // Lookup the property in the object.
486 LookupResult lookup; 486 LookupResult lookup(isolate());
487 LookupForRead(*object, *name, &lookup); 487 LookupForRead(*object, *name, &lookup);
488 488
489 if (!lookup.IsProperty()) { 489 if (!lookup.IsProperty()) {
490 // If the object does not have the requested property, check which 490 // If the object does not have the requested property, check which
491 // exception we need to throw. 491 // exception we need to throw.
492 if (IsContextual(object)) { 492 if (IsContextual(object)) {
493 return ReferenceError("not_defined", name); 493 return ReferenceError("not_defined", name);
494 } 494 }
495 return TypeError("undefined_method", object, name); 495 return TypeError("undefined_method", object, name);
496 } 496 }
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 return Accessors::FunctionGetPrototype(*object, 0); 928 return Accessors::FunctionGetPrototype(*object, 0);
929 } 929 }
930 } 930 }
931 931
932 // Check if the name is trivially convertible to an index and get 932 // Check if the name is trivially convertible to an index and get
933 // the element if so. 933 // the element if so.
934 uint32_t index; 934 uint32_t index;
935 if (name->AsArrayIndex(&index)) return object->GetElement(index); 935 if (name->AsArrayIndex(&index)) return object->GetElement(index);
936 936
937 // Named lookup in the object. 937 // Named lookup in the object.
938 LookupResult lookup; 938 LookupResult lookup(isolate());
939 LookupForRead(*object, *name, &lookup); 939 LookupForRead(*object, *name, &lookup);
940 940
941 // If we did not find a property, check if we need to throw an exception. 941 // If we did not find a property, check if we need to throw an exception.
942 if (!lookup.IsProperty()) { 942 if (!lookup.IsProperty()) {
943 if (IsContextual(object)) { 943 if (IsContextual(object)) {
944 return ReferenceError("not_defined", name); 944 return ReferenceError("not_defined", name);
945 } 945 }
946 LOG(isolate(), SuspectReadEvent(*name, *object)); 946 LOG(isolate(), SuspectReadEvent(*name, *object));
947 } 947 }
948 948
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
1196 // the element or char if so. 1196 // the element or char if so.
1197 uint32_t index = 0; 1197 uint32_t index = 0;
1198 if (name->AsArrayIndex(&index)) { 1198 if (name->AsArrayIndex(&index)) {
1199 HandleScope scope(isolate()); 1199 HandleScope scope(isolate());
1200 // Rewrite to the generic keyed load stub. 1200 // Rewrite to the generic keyed load stub.
1201 if (FLAG_use_ic) set_target(generic_stub()); 1201 if (FLAG_use_ic) set_target(generic_stub());
1202 return Runtime::GetElementOrCharAt(isolate(), object, index); 1202 return Runtime::GetElementOrCharAt(isolate(), object, index);
1203 } 1203 }
1204 1204
1205 // Named lookup. 1205 // Named lookup.
1206 LookupResult lookup; 1206 LookupResult lookup(isolate());
1207 LookupForRead(*object, *name, &lookup); 1207 LookupForRead(*object, *name, &lookup);
1208 1208
1209 // If we did not find a property, check if we need to throw an exception. 1209 // If we did not find a property, check if we need to throw an exception.
1210 if (!lookup.IsProperty() && IsContextual(object)) { 1210 if (!lookup.IsProperty() && IsContextual(object)) {
1211 return ReferenceError("not_defined", name); 1211 return ReferenceError("not_defined", name);
1212 } 1212 }
1213 1213
1214 if (FLAG_use_ic) { 1214 if (FLAG_use_ic) {
1215 UpdateCaches(&lookup, state, object, name); 1215 UpdateCaches(&lookup, state, object, name);
1216 } 1216 }
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
1428 #endif 1428 #endif
1429 Builtins::Name target = (strict_mode == kStrictMode) 1429 Builtins::Name target = (strict_mode == kStrictMode)
1430 ? Builtins::kStoreIC_ArrayLength_Strict 1430 ? Builtins::kStoreIC_ArrayLength_Strict
1431 : Builtins::kStoreIC_ArrayLength; 1431 : Builtins::kStoreIC_ArrayLength;
1432 set_target(isolate()->builtins()->builtin(target)); 1432 set_target(isolate()->builtins()->builtin(target));
1433 return receiver->SetProperty(*name, *value, NONE, strict_mode); 1433 return receiver->SetProperty(*name, *value, NONE, strict_mode);
1434 } 1434 }
1435 1435
1436 // Lookup the property locally in the receiver. 1436 // Lookup the property locally in the receiver.
1437 if (FLAG_use_ic && !receiver->IsJSGlobalProxy()) { 1437 if (FLAG_use_ic && !receiver->IsJSGlobalProxy()) {
1438 LookupResult lookup; 1438 LookupResult lookup(isolate());
1439 1439
1440 if (LookupForWrite(*receiver, *name, &lookup)) { 1440 if (LookupForWrite(*receiver, *name, &lookup)) {
1441 // Generate a stub for this store. 1441 // Generate a stub for this store.
1442 UpdateCaches(&lookup, state, strict_mode, receiver, name, value); 1442 UpdateCaches(&lookup, state, strict_mode, receiver, name, value);
1443 } else { 1443 } else {
1444 // Strict mode doesn't allow setting non-existent global property 1444 // Strict mode doesn't allow setting non-existent global property
1445 // or an assignment to a read only property. 1445 // or an assignment to a read only property.
1446 if (strict_mode == kStrictMode) { 1446 if (strict_mode == kStrictMode) {
1447 if (lookup.IsFound() && lookup.IsReadOnly()) { 1447 if (lookup.IsFound() && lookup.IsReadOnly()) {
1448 return TypeError("strict_read_only_property", object, name); 1448 return TypeError("strict_read_only_property", object, name);
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
1842 // Check if the given name is an array index. 1842 // Check if the given name is an array index.
1843 uint32_t index; 1843 uint32_t index;
1844 if (name->AsArrayIndex(&index)) { 1844 if (name->AsArrayIndex(&index)) {
1845 HandleScope scope(isolate()); 1845 HandleScope scope(isolate());
1846 Handle<Object> result = SetElement(receiver, index, value, strict_mode); 1846 Handle<Object> result = SetElement(receiver, index, value, strict_mode);
1847 if (result.is_null()) return Failure::Exception(); 1847 if (result.is_null()) return Failure::Exception();
1848 return *value; 1848 return *value;
1849 } 1849 }
1850 1850
1851 // Lookup the property locally in the receiver. 1851 // Lookup the property locally in the receiver.
1852 LookupResult lookup; 1852 LookupResult lookup(isolate());
1853 receiver->LocalLookup(*name, &lookup); 1853 receiver->LocalLookup(*name, &lookup);
1854 1854
1855 // Update inline cache and stub cache. 1855 // Update inline cache and stub cache.
1856 if (FLAG_use_ic) { 1856 if (FLAG_use_ic) {
1857 UpdateCaches(&lookup, state, strict_mode, receiver, name, value); 1857 UpdateCaches(&lookup, state, strict_mode, receiver, name, value);
1858 } 1858 }
1859 1859
1860 // Set the property. 1860 // Set the property.
1861 return receiver->SetProperty(*name, *value, NONE, strict_mode); 1861 return receiver->SetProperty(*name, *value, NONE, strict_mode);
1862 } 1862 }
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
2612 #undef ADDR 2612 #undef ADDR
2613 }; 2613 };
2614 2614
2615 2615
2616 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2616 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2617 return IC_utilities[id]; 2617 return IC_utilities[id];
2618 } 2618 }
2619 2619
2620 2620
2621 } } // namespace v8::internal 2621 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/stub-cache-ia32.cc ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698