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

Side by Side Diff: src/objects.cc

Issue 9280007: Replaced LookupResult::IsProperty by LookupResult::IsFound where possible. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 2 fixes Created 8 years, 11 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/mips/stub-cache-mips.cc ('k') | src/runtime.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 4335 matching lines...) Expand 10 before | Expand all | Expand 10 after
4346 } 4346 }
4347 4347
4348 4348
4349 // Search object and it's prototype chain for callback properties. 4349 // Search object and it's prototype chain for callback properties.
4350 void JSObject::LookupCallback(String* name, LookupResult* result) { 4350 void JSObject::LookupCallback(String* name, LookupResult* result) {
4351 Heap* heap = GetHeap(); 4351 Heap* heap = GetHeap();
4352 for (Object* current = this; 4352 for (Object* current = this;
4353 current != heap->null_value() && current->IsJSObject(); 4353 current != heap->null_value() && current->IsJSObject();
4354 current = JSObject::cast(current)->GetPrototype()) { 4354 current = JSObject::cast(current)->GetPrototype()) {
4355 JSObject::cast(current)->LocalLookupRealNamedProperty(name, result); 4355 JSObject::cast(current)->LocalLookupRealNamedProperty(name, result);
4356 if (result->IsProperty() && result->type() == CALLBACKS) return; 4356 if (result->IsFound() && result->type() == CALLBACKS) return;
4357 } 4357 }
4358 result->NotFound(); 4358 result->NotFound();
4359 } 4359 }
4360 4360
4361 4361
4362 // Search for a getter or setter in an elements dictionary and update its 4362 // Search for a getter or setter in an elements dictionary and update its
4363 // attributes. Returns either undefined if the element is non-deletable, or the 4363 // attributes. Returns either undefined if the element is non-deletable, or the
4364 // getter/setter pair if there is an existing one, or the hole value if the 4364 // getter/setter pair if there is an existing one, or the hole value if the
4365 // element does not exist or is a normal non-getter/setter data element. 4365 // element does not exist or is a normal non-getter/setter data element.
4366 static Object* UpdateGetterSetterInDictionary( 4366 static Object* UpdateGetterSetterInDictionary(
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
4450 if (!probe->IsTheHole()) return probe; 4450 if (!probe->IsTheHole()) return probe;
4451 } 4451 }
4452 } 4452 }
4453 break; 4453 break;
4454 } 4454 }
4455 } 4455 }
4456 } else { 4456 } else {
4457 // Lookup the name. 4457 // Lookup the name.
4458 LookupResult result(heap->isolate()); 4458 LookupResult result(heap->isolate());
4459 LocalLookupRealNamedProperty(name, &result); 4459 LocalLookupRealNamedProperty(name, &result);
4460 if (result.IsProperty()) { 4460 if (result.IsFound()) {
4461 // TODO(mstarzinger): We should check for result.IsDontDelete() here once 4461 // TODO(mstarzinger): We should check for result.IsDontDelete() here once
4462 // we only call into the runtime once to set both getter and setter. 4462 // we only call into the runtime once to set both getter and setter.
4463 if (result.type() == CALLBACKS) { 4463 if (result.type() == CALLBACKS) {
4464 Object* obj = result.GetCallbackObject(); 4464 Object* obj = result.GetCallbackObject();
4465 // Need to preserve old getters/setters. 4465 // Need to preserve old getters/setters.
4466 if (obj->IsAccessorPair()) { 4466 if (obj->IsAccessorPair()) {
4467 // Use set to update attributes. 4467 // Use set to update attributes.
4468 return SetPropertyCallback(name, obj, attributes); 4468 return SetPropertyCallback(name, obj, attributes);
4469 } 4469 }
4470 } 4470 }
(...skipping 2994 matching lines...) Expand 10 before | Expand all | Expand 10 after
7465 // Traverse the proposed prototype chain looking for setters for properties of 7465 // Traverse the proposed prototype chain looking for setters for properties of
7466 // the same names as are set by the inline constructor. 7466 // the same names as are set by the inline constructor.
7467 for (Object* obj = prototype; 7467 for (Object* obj = prototype;
7468 obj != heap->null_value(); 7468 obj != heap->null_value();
7469 obj = obj->GetPrototype()) { 7469 obj = obj->GetPrototype()) {
7470 JSObject* js_object = JSObject::cast(obj); 7470 JSObject* js_object = JSObject::cast(obj);
7471 for (int i = 0; i < this_property_assignments_count(); i++) { 7471 for (int i = 0; i < this_property_assignments_count(); i++) {
7472 LookupResult result(heap->isolate()); 7472 LookupResult result(heap->isolate());
7473 String* name = GetThisPropertyAssignmentName(i); 7473 String* name = GetThisPropertyAssignmentName(i);
7474 js_object->LocalLookupRealNamedProperty(name, &result); 7474 js_object->LocalLookupRealNamedProperty(name, &result);
7475 if (result.IsProperty() && result.type() == CALLBACKS) { 7475 if (result.IsFound() && result.type() == CALLBACKS) {
7476 return false; 7476 return false;
7477 } 7477 }
7478 } 7478 }
7479 } 7479 }
7480 7480
7481 return true; 7481 return true;
7482 } 7482 }
7483 7483
7484 7484
7485 void SharedFunctionInfo::ForbidInlineConstructor() { 7485 void SharedFunctionInfo::ForbidInlineConstructor() {
(...skipping 2653 matching lines...) Expand 10 before | Expand all | Expand 10 after
10139 Isolate* isolate = GetIsolate(); 10139 Isolate* isolate = GetIsolate();
10140 if (IsAccessCheckNeeded()) { 10140 if (IsAccessCheckNeeded()) {
10141 if (!isolate->MayNamedAccess(this, key, v8::ACCESS_HAS)) { 10141 if (!isolate->MayNamedAccess(this, key, v8::ACCESS_HAS)) {
10142 isolate->ReportFailedAccessCheck(this, v8::ACCESS_HAS); 10142 isolate->ReportFailedAccessCheck(this, v8::ACCESS_HAS);
10143 return false; 10143 return false;
10144 } 10144 }
10145 } 10145 }
10146 10146
10147 LookupResult result(isolate); 10147 LookupResult result(isolate);
10148 LocalLookupRealNamedProperty(key, &result); 10148 LocalLookupRealNamedProperty(key, &result);
10149 return result.IsProperty() && (result.type() == CALLBACKS); 10149 return result.IsFound() && (result.type() == CALLBACKS);
10150 } 10150 }
10151 10151
10152 10152
10153 int JSObject::NumberOfLocalProperties(PropertyAttributes filter) { 10153 int JSObject::NumberOfLocalProperties(PropertyAttributes filter) {
10154 if (HasFastProperties()) { 10154 if (HasFastProperties()) {
10155 DescriptorArray* descs = map()->instance_descriptors(); 10155 DescriptorArray* descs = map()->instance_descriptors();
10156 int result = 0; 10156 int result = 0;
10157 for (int i = 0; i < descs->number_of_descriptors(); i++) { 10157 for (int i = 0; i < descs->number_of_descriptors(); i++) {
10158 PropertyDetails details(descs->GetDetails(i)); 10158 PropertyDetails details(descs->GetDetails(i));
10159 if (details.IsProperty() && (details.attributes() & filter) == 0) { 10159 if (details.IsProperty() && (details.attributes() & filter) == 0) {
(...skipping 2649 matching lines...) Expand 10 before | Expand all | Expand 10 after
12809 if (break_point_objects()->IsUndefined()) return 0; 12809 if (break_point_objects()->IsUndefined()) return 0;
12810 // Single break point. 12810 // Single break point.
12811 if (!break_point_objects()->IsFixedArray()) return 1; 12811 if (!break_point_objects()->IsFixedArray()) return 1;
12812 // Multiple break points. 12812 // Multiple break points.
12813 return FixedArray::cast(break_point_objects())->length(); 12813 return FixedArray::cast(break_point_objects())->length();
12814 } 12814 }
12815 #endif // ENABLE_DEBUGGER_SUPPORT 12815 #endif // ENABLE_DEBUGGER_SUPPORT
12816 12816
12817 12817
12818 } } // namespace v8::internal 12818 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips/stub-cache-mips.cc ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698