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

Side by Side Diff: src/objects.cc

Issue 7655030: Unify GetElement handlers in ElementsAccessor (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: merge with latest Created 9 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/elements.cc ('k') | no next file » | 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 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 isolate->ReportFailedAccessCheck(js_object, v8::ACCESS_GET); 649 isolate->ReportFailedAccessCheck(js_object, v8::ACCESS_GET);
650 return heap->undefined_value(); 650 return heap->undefined_value();
651 } 651 }
652 } 652 }
653 653
654 if (js_object->HasIndexedInterceptor()) { 654 if (js_object->HasIndexedInterceptor()) {
655 return js_object->GetElementWithInterceptor(receiver, index); 655 return js_object->GetElementWithInterceptor(receiver, index);
656 } 656 }
657 657
658 if (js_object->elements() != heap->empty_fixed_array()) { 658 if (js_object->elements() != heap->empty_fixed_array()) {
659 MaybeObject* result = js_object->GetElementsAccessor()->GetWithReceiver( 659 MaybeObject* result = js_object->GetElementsAccessor()->Get(
660 js_object->elements(),
661 index,
660 js_object, 662 js_object,
661 receiver, 663 receiver);
662 index);
663 if (result != heap->the_hole_value()) return result; 664 if (result != heap->the_hole_value()) return result;
664 } 665 }
665 } 666 }
666 667
667 return heap->undefined_value(); 668 return heap->undefined_value();
668 } 669 }
669 670
670 671
671 Object* Object::GetPrototype() { 672 Object* Object::GetPrototype() {
672 if (IsSmi()) { 673 if (IsSmi()) {
(...skipping 3947 matching lines...) Expand 10 before | Expand all | Expand 10 after
4620 cache->set(EntryToIndex(entry), obj); 4621 cache->set(EntryToIndex(entry), obj);
4621 cache->set(EntryToIndex(entry) + 1, code); 4622 cache->set(EntryToIndex(entry) + 1, code);
4622 cache->ElementAdded(); 4623 cache->ElementAdded();
4623 return cache; 4624 return cache;
4624 } 4625 }
4625 4626
4626 4627
4627 MaybeObject* FixedArray::AddKeysFromJSArray(JSArray* array) { 4628 MaybeObject* FixedArray::AddKeysFromJSArray(JSArray* array) {
4628 ElementsAccessor* accessor = array->GetElementsAccessor(); 4629 ElementsAccessor* accessor = array->GetElementsAccessor();
4629 MaybeObject* maybe_result = 4630 MaybeObject* maybe_result =
4630 accessor->AddElementsToFixedArray(array->elements(), this); 4631 accessor->AddElementsToFixedArray(array->elements(), this, array, array);
4631 FixedArray* result; 4632 FixedArray* result;
4632 if (!maybe_result->To<FixedArray>(&result)) return maybe_result; 4633 if (!maybe_result->To<FixedArray>(&result)) return maybe_result;
4633 #ifdef DEBUG 4634 #ifdef DEBUG
4634 if (FLAG_enable_slow_asserts) { 4635 if (FLAG_enable_slow_asserts) {
4635 for (int i = 0; i < result->length(); i++) { 4636 for (int i = 0; i < result->length(); i++) {
4636 Object* current = result->get(i); 4637 Object* current = result->get(i);
4637 ASSERT(current->IsNumber() || current->IsString()); 4638 ASSERT(current->IsNumber() || current->IsString());
4638 } 4639 }
4639 } 4640 }
4640 #endif 4641 #endif
4641 return result; 4642 return result;
4642 } 4643 }
4643 4644
4644 4645
4645 MaybeObject* FixedArray::UnionOfKeys(FixedArray* other) { 4646 MaybeObject* FixedArray::UnionOfKeys(FixedArray* other) {
4646 ElementsAccessor* accessor = ElementsAccessor::ForArray(other); 4647 ElementsAccessor* accessor = ElementsAccessor::ForArray(other);
4647 MaybeObject* maybe_result = 4648 MaybeObject* maybe_result =
4648 accessor->AddElementsToFixedArray(other, this); 4649 accessor->AddElementsToFixedArray(other, this, NULL, NULL);
4649 FixedArray* result; 4650 FixedArray* result;
4650 if (!maybe_result->To<FixedArray>(&result)) return maybe_result; 4651 if (!maybe_result->To<FixedArray>(&result)) return maybe_result;
4651 #ifdef DEBUG 4652 #ifdef DEBUG
4652 if (FLAG_enable_slow_asserts) { 4653 if (FLAG_enable_slow_asserts) {
4653 for (int i = 0; i < result->length(); i++) { 4654 for (int i = 0; i < result->length(); i++) {
4654 Object* current = result->get(i); 4655 Object* current = result->get(i);
4655 ASSERT(current->IsNumber() || current->IsString()); 4656 ASSERT(current->IsNumber() || current->IsString());
4656 } 4657 }
4657 } 4658 }
4658 #endif 4659 #endif
(...skipping 4002 matching lines...) Expand 10 before | Expand all | Expand 10 after
8661 // Leaving JavaScript. 8662 // Leaving JavaScript.
8662 VMState state(isolate, EXTERNAL); 8663 VMState state(isolate, EXTERNAL);
8663 result = getter(index, info); 8664 result = getter(index, info);
8664 } 8665 }
8665 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 8666 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
8666 if (!result.IsEmpty()) return *v8::Utils::OpenHandle(*result); 8667 if (!result.IsEmpty()) return *v8::Utils::OpenHandle(*result);
8667 } 8668 }
8668 8669
8669 Heap* heap = holder_handle->GetHeap(); 8670 Heap* heap = holder_handle->GetHeap();
8670 ElementsAccessor* handler = holder_handle->GetElementsAccessor(); 8671 ElementsAccessor* handler = holder_handle->GetElementsAccessor();
8671 MaybeObject* raw_result = handler->GetWithReceiver(*holder_handle, 8672 MaybeObject* raw_result = handler->Get(holder_handle->elements(),
8672 *this_handle, 8673 index,
8673 index); 8674 *holder_handle,
8675 *this_handle);
8674 if (raw_result != heap->the_hole_value()) return raw_result; 8676 if (raw_result != heap->the_hole_value()) return raw_result;
8675 8677
8676 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 8678 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
8677 8679
8678 Object* pt = holder_handle->GetPrototype(); 8680 Object* pt = holder_handle->GetPrototype();
8679 if (pt == heap->null_value()) return heap->undefined_value(); 8681 if (pt == heap->null_value()) return heap->undefined_value();
8680 return pt->GetElementWithReceiver(*this_handle, index); 8682 return pt->GetElementWithReceiver(*this_handle, index);
8681 } 8683 }
8682 8684
8683 8685
(...skipping 2867 matching lines...) Expand 10 before | Expand all | Expand 10 after
11551 if (break_point_objects()->IsUndefined()) return 0; 11553 if (break_point_objects()->IsUndefined()) return 0;
11552 // Single break point. 11554 // Single break point.
11553 if (!break_point_objects()->IsFixedArray()) return 1; 11555 if (!break_point_objects()->IsFixedArray()) return 1;
11554 // Multiple break points. 11556 // Multiple break points.
11555 return FixedArray::cast(break_point_objects())->length(); 11557 return FixedArray::cast(break_point_objects())->length();
11556 } 11558 }
11557 #endif 11559 #endif
11558 11560
11559 11561
11560 } } // namespace v8::internal 11562 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/elements.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698