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

Side by Side Diff: src/objects.cc

Issue 480823004: Get rid of GetLazyValue and clients. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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/objects.h ('k') | src/property.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/allocation-site-scopes.h" 8 #include "src/allocation-site-scopes.h"
9 #include "src/api.h" 9 #include "src/api.h"
10 #include "src/arguments.h" 10 #include "src/arguments.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 break; 136 break;
137 } 137 }
138 } 138 }
139 return it->factory()->undefined_value(); 139 return it->factory()->undefined_value();
140 } 140 }
141 141
142 142
143 Handle<Object> JSObject::GetDataProperty(Handle<JSObject> object, 143 Handle<Object> JSObject::GetDataProperty(Handle<JSObject> object,
144 Handle<Name> key) { 144 Handle<Name> key) {
145 LookupIterator it(object, key, LookupIterator::CHECK_DERIVED_PROPERTY); 145 LookupIterator it(object, key, LookupIterator::CHECK_DERIVED_PROPERTY);
146 for (; it.IsFound(); it.Next()) { 146 return GetDataProperty(&it);
147 switch (it.state()) { 147 }
148
149
150 Handle<Object> JSObject::GetDataProperty(LookupIterator* it) {
151 for (; it->IsFound(); it->Next()) {
152 switch (it->state()) {
148 case LookupIterator::NOT_FOUND: 153 case LookupIterator::NOT_FOUND:
149 case LookupIterator::ACCESS_CHECK: 154 case LookupIterator::ACCESS_CHECK:
150 case LookupIterator::INTERCEPTOR: 155 case LookupIterator::INTERCEPTOR:
151 UNREACHABLE(); 156 UNREACHABLE();
152 case LookupIterator::JSPROXY: 157 case LookupIterator::JSPROXY:
153 return it.isolate()->factory()->undefined_value(); 158 it->NotFound();
159 return it->isolate()->factory()->undefined_value();
154 case LookupIterator::PROPERTY: 160 case LookupIterator::PROPERTY:
155 if (!it.HasProperty()) continue; 161 if (!it->HasProperty()) continue;
156 switch (it.property_kind()) { 162 switch (it->property_kind()) {
157 case LookupIterator::DATA: 163 case LookupIterator::DATA:
158 return it.GetDataValue(); 164 return it->GetDataValue();
159 case LookupIterator::ACCESSOR: 165 case LookupIterator::ACCESSOR:
160 // TODO(verwaest): For now this doesn't call into 166 // TODO(verwaest): For now this doesn't call into
161 // ExecutableAccessorInfo, since clients don't need it. Update once 167 // ExecutableAccessorInfo, since clients don't need it. Update once
162 // relevant. 168 // relevant.
163 return it.isolate()->factory()->undefined_value(); 169 it->NotFound();
170 return it->isolate()->factory()->undefined_value();
164 } 171 }
165 } 172 }
166 } 173 }
167 return it.isolate()->factory()->undefined_value(); 174 return it->isolate()->factory()->undefined_value();
168 } 175 }
169 176
170 177
171 bool Object::ToInt32(int32_t* value) { 178 bool Object::ToInt32(int32_t* value) {
172 if (IsSmi()) { 179 if (IsSmi()) {
173 *value = Smi::cast(this)->value(); 180 *value = Smi::cast(this)->value();
174 return true; 181 return true;
175 } 182 }
176 if (IsHeapNumber()) { 183 if (IsHeapNumber()) {
177 double num = HeapNumber::cast(this)->value(); 184 double num = HeapNumber::cast(this)->value();
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 it->GetHolder<JSObject>(), 647 it->GetHolder<JSObject>(),
641 it->GetAccessors(), strict_mode); 648 it->GetAccessors(), strict_mode);
642 } 649 }
643 650
644 it->isolate()->ReportFailedAccessCheck(checked, v8::ACCESS_SET); 651 it->isolate()->ReportFailedAccessCheck(checked, v8::ACCESS_SET);
645 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(it->isolate(), Object); 652 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(it->isolate(), Object);
646 return value; 653 return value;
647 } 654 }
648 655
649 656
650 Object* JSObject::GetNormalizedProperty(const LookupResult* result) {
651 DCHECK(!HasFastProperties());
652 Object* value = property_dictionary()->ValueAt(result->GetDictionaryEntry());
653 if (IsGlobalObject()) {
654 value = PropertyCell::cast(value)->value();
655 }
656 DCHECK(!value->IsPropertyCell() && !value->IsCell());
657 return value;
658 }
659
660
661 void JSObject::SetNormalizedProperty(Handle<JSObject> object, 657 void JSObject::SetNormalizedProperty(Handle<JSObject> object,
662 Handle<Name> name, 658 Handle<Name> name,
663 Handle<Object> value, 659 Handle<Object> value,
664 PropertyDetails details) { 660 PropertyDetails details) {
665 DCHECK(!object->HasFastProperties()); 661 DCHECK(!object->HasFastProperties());
666 Handle<NameDictionary> property_dictionary(object->property_dictionary()); 662 Handle<NameDictionary> property_dictionary(object->property_dictionary());
667 663
668 if (!name->IsUniqueName()) { 664 if (!name->IsUniqueName()) {
669 name = object->GetIsolate()->factory()->InternalizeString( 665 name = object->GetIsolate()->factory()->InternalizeString(
670 Handle<String>::cast(name)); 666 Handle<String>::cast(name));
(...skipping 4088 matching lines...) Expand 10 before | Expand all | Expand 10 after
4759 sorted_index); 4755 sorted_index);
4760 return this->RawFastPropertyAt(index); 4756 return this->RawFastPropertyAt(index);
4761 } else { 4757 } else {
4762 return GetHeap()->undefined_value(); 4758 return GetHeap()->undefined_value();
4763 } 4759 }
4764 } else { 4760 } else {
4765 return GetHeap()->undefined_value(); 4761 return GetHeap()->undefined_value();
4766 } 4762 }
4767 } else { 4763 } else {
4768 Isolate* isolate = GetIsolate(); 4764 Isolate* isolate = GetIsolate();
4769 LookupResult result(isolate); 4765 LookupIterator it(handle(this), isolate->factory()->hidden_string(),
4770 LookupOwnRealNamedProperty(isolate->factory()->hidden_string(), &result); 4766 LookupIterator::CHECK_PROPERTY);
4771 if (result.IsFound()) { 4767 if (it.IsFound() && it.HasProperty()) {
4772 DCHECK(result.IsNormal()); 4768 DCHECK_EQ(LookupIterator::DATA, it.property_kind());
4773 DCHECK(result.holder() == this); 4769 return *it.GetDataValue();
4774 return GetNormalizedProperty(&result);
4775 } 4770 }
4776 return GetHeap()->undefined_value(); 4771 return GetHeap()->undefined_value();
4777 } 4772 }
4778 } 4773 }
4779 4774
4780 Handle<ObjectHashTable> JSObject::GetOrCreateHiddenPropertiesHashtable( 4775 Handle<ObjectHashTable> JSObject::GetOrCreateHiddenPropertiesHashtable(
4781 Handle<JSObject> object) { 4776 Handle<JSObject> object) {
4782 Isolate* isolate = object->GetIsolate(); 4777 Isolate* isolate = object->GetIsolate();
4783 4778
4784 static const int kInitialCapacity = 4; 4779 static const int kInitialCapacity = 4;
(...skipping 11777 matching lines...) Expand 10 before | Expand all | Expand 10 after
16562 #define ERROR_MESSAGES_TEXTS(C, T) T, 16557 #define ERROR_MESSAGES_TEXTS(C, T) T,
16563 static const char* error_messages_[] = { 16558 static const char* error_messages_[] = {
16564 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 16559 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16565 }; 16560 };
16566 #undef ERROR_MESSAGES_TEXTS 16561 #undef ERROR_MESSAGES_TEXTS
16567 return error_messages_[reason]; 16562 return error_messages_[reason];
16568 } 16563 }
16569 16564
16570 16565
16571 } } // namespace v8::internal 16566 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/property.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698