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

Side by Side Diff: src/objects.cc

Issue 9605006: Consistently order receiver and holder argument in ElementAccessor. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 8 years, 9 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 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 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 return heap->undefined_value(); 684 return heap->undefined_value();
685 } 685 }
686 } 686 }
687 687
688 if (js_object->HasIndexedInterceptor()) { 688 if (js_object->HasIndexedInterceptor()) {
689 return js_object->GetElementWithInterceptor(receiver, index); 689 return js_object->GetElementWithInterceptor(receiver, index);
690 } 690 }
691 691
692 if (js_object->elements() != heap->empty_fixed_array()) { 692 if (js_object->elements() != heap->empty_fixed_array()) {
693 MaybeObject* result = js_object->GetElementsAccessor()->Get( 693 MaybeObject* result = js_object->GetElementsAccessor()->Get(
694 js_object->elements(), 694 receiver, js_object, index);
695 index,
696 js_object,
697 receiver);
698 if (result != heap->the_hole_value()) return result; 695 if (result != heap->the_hole_value()) return result;
699 } 696 }
700 } 697 }
701 698
702 return heap->undefined_value(); 699 return heap->undefined_value();
703 } 700 }
704 701
705 702
706 Object* Object::GetPrototype() { 703 Object* Object::GetPrototype() {
707 if (IsSmi()) { 704 if (IsSmi()) {
(...skipping 4836 matching lines...) Expand 10 before | Expand all | Expand 10 after
5544 cache->set(EntryToIndex(entry), obj); 5541 cache->set(EntryToIndex(entry), obj);
5545 cache->set(EntryToIndex(entry) + 1, code); 5542 cache->set(EntryToIndex(entry) + 1, code);
5546 cache->ElementAdded(); 5543 cache->ElementAdded();
5547 return cache; 5544 return cache;
5548 } 5545 }
5549 5546
5550 5547
5551 MaybeObject* FixedArray::AddKeysFromJSArray(JSArray* array) { 5548 MaybeObject* FixedArray::AddKeysFromJSArray(JSArray* array) {
5552 ElementsAccessor* accessor = array->GetElementsAccessor(); 5549 ElementsAccessor* accessor = array->GetElementsAccessor();
5553 MaybeObject* maybe_result = 5550 MaybeObject* maybe_result =
5554 accessor->AddElementsToFixedArray(array->elements(), this, array, array); 5551 accessor->AddElementsToFixedArray(array, array, this);
5555 FixedArray* result; 5552 FixedArray* result;
5556 if (!maybe_result->To<FixedArray>(&result)) return maybe_result; 5553 if (!maybe_result->To<FixedArray>(&result)) return maybe_result;
5557 #ifdef DEBUG 5554 #ifdef DEBUG
5558 if (FLAG_enable_slow_asserts) { 5555 if (FLAG_enable_slow_asserts) {
5559 for (int i = 0; i < result->length(); i++) { 5556 for (int i = 0; i < result->length(); i++) {
5560 Object* current = result->get(i); 5557 Object* current = result->get(i);
5561 ASSERT(current->IsNumber() || current->IsString()); 5558 ASSERT(current->IsNumber() || current->IsString());
5562 } 5559 }
5563 } 5560 }
5564 #endif 5561 #endif
5565 return result; 5562 return result;
5566 } 5563 }
5567 5564
5568 5565
5569 MaybeObject* FixedArray::UnionOfKeys(FixedArray* other) { 5566 MaybeObject* FixedArray::UnionOfKeys(FixedArray* other) {
5570 ElementsAccessor* accessor = ElementsAccessor::ForArray(other); 5567 ElementsAccessor* accessor = ElementsAccessor::ForArray(other);
5571 MaybeObject* maybe_result = 5568 MaybeObject* maybe_result =
5572 accessor->AddElementsToFixedArray(other, this, NULL, NULL); 5569 accessor->AddElementsToFixedArray(NULL, NULL, this, other);
5573 FixedArray* result; 5570 FixedArray* result;
5574 if (!maybe_result->To<FixedArray>(&result)) return maybe_result; 5571 if (!maybe_result->To<FixedArray>(&result)) return maybe_result;
5575 #ifdef DEBUG 5572 #ifdef DEBUG
5576 if (FLAG_enable_slow_asserts) { 5573 if (FLAG_enable_slow_asserts) {
5577 for (int i = 0; i < result->length(); i++) { 5574 for (int i = 0; i < result->length(); i++) {
5578 Object* current = result->get(i); 5575 Object* current = result->get(i);
5579 ASSERT(current->IsNumber() || current->IsString()); 5576 ASSERT(current->IsNumber() || current->IsString());
5580 } 5577 }
5581 } 5578 }
5582 #endif 5579 #endif
(...skipping 3305 matching lines...) Expand 10 before | Expand all | Expand 10 after
8888 v8::Handle<v8::Value> result; 8885 v8::Handle<v8::Value> result;
8889 { 8886 {
8890 // Leaving JavaScript. 8887 // Leaving JavaScript.
8891 VMState state(isolate, EXTERNAL); 8888 VMState state(isolate, EXTERNAL);
8892 result = getter(index, info); 8889 result = getter(index, info);
8893 } 8890 }
8894 if (!result.IsEmpty()) return true; 8891 if (!result.IsEmpty()) return true;
8895 } 8892 }
8896 8893
8897 if (holder_handle->GetElementsAccessor()->HasElement( 8894 if (holder_handle->GetElementsAccessor()->HasElement(
8898 holder_handle->elements(), index, *holder_handle, *receiver_handle)) { 8895 *receiver_handle, *holder_handle, index)) {
8899 return true; 8896 return true;
8900 } 8897 }
8901 8898
8902 if (holder_handle->IsStringObjectWithCharacterAt(index)) return true; 8899 if (holder_handle->IsStringObjectWithCharacterAt(index)) return true;
8903 Object* pt = holder_handle->GetPrototype(); 8900 Object* pt = holder_handle->GetPrototype();
8904 if (pt->IsJSProxy()) { 8901 if (pt->IsJSProxy()) {
8905 // We need to follow the spec and simulate a call to [[GetOwnProperty]]. 8902 // We need to follow the spec and simulate a call to [[GetOwnProperty]].
8906 return JSProxy::cast(pt)->GetElementAttributeWithHandler( 8903 return JSProxy::cast(pt)->GetElementAttributeWithHandler(
8907 receiver, index) != ABSENT; 8904 receiver, index) != ABSENT;
8908 } 8905 }
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
9026 return false; 9023 return false;
9027 } 9024 }
9028 } 9025 }
9029 9026
9030 // Check for lookup interceptor 9027 // Check for lookup interceptor
9031 if (HasIndexedInterceptor()) { 9028 if (HasIndexedInterceptor()) {
9032 return HasElementWithInterceptor(receiver, index); 9029 return HasElementWithInterceptor(receiver, index);
9033 } 9030 }
9034 9031
9035 ElementsAccessor* accessor = GetElementsAccessor(); 9032 ElementsAccessor* accessor = GetElementsAccessor();
9036 if (accessor->HasElement(elements(), index, this, receiver)) { 9033 if (accessor->HasElement(receiver, this, index)) {
9037 return true; 9034 return true;
9038 } 9035 }
9039 9036
9040 // Handle [] on String objects. 9037 // Handle [] on String objects.
9041 if (this->IsStringObjectWithCharacterAt(index)) return true; 9038 if (this->IsStringObjectWithCharacterAt(index)) return true;
9042 9039
9043 Object* pt = GetPrototype(); 9040 Object* pt = GetPrototype();
9044 if (pt->IsNull()) return false; 9041 if (pt->IsNull()) return false;
9045 if (pt->IsJSProxy()) { 9042 if (pt->IsJSProxy()) {
9046 // We need to follow the spec and simulate a call to [[GetOwnProperty]]. 9043 // We need to follow the spec and simulate a call to [[GetOwnProperty]].
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
9887 // Leaving JavaScript. 9884 // Leaving JavaScript.
9888 VMState state(isolate, EXTERNAL); 9885 VMState state(isolate, EXTERNAL);
9889 result = getter(index, info); 9886 result = getter(index, info);
9890 } 9887 }
9891 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 9888 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
9892 if (!result.IsEmpty()) return *v8::Utils::OpenHandle(*result); 9889 if (!result.IsEmpty()) return *v8::Utils::OpenHandle(*result);
9893 } 9890 }
9894 9891
9895 Heap* heap = holder_handle->GetHeap(); 9892 Heap* heap = holder_handle->GetHeap();
9896 ElementsAccessor* handler = holder_handle->GetElementsAccessor(); 9893 ElementsAccessor* handler = holder_handle->GetElementsAccessor();
9897 MaybeObject* raw_result = handler->Get(holder_handle->elements(), 9894 MaybeObject* raw_result = handler->Get(*this_handle,
9898 index,
9899 *holder_handle, 9895 *holder_handle,
9900 *this_handle); 9896 index);
9901 if (raw_result != heap->the_hole_value()) return raw_result; 9897 if (raw_result != heap->the_hole_value()) return raw_result;
9902 9898
9903 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 9899 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
9904 9900
9905 Object* pt = holder_handle->GetPrototype(); 9901 Object* pt = holder_handle->GetPrototype();
9906 if (pt == heap->null_value()) return heap->undefined_value(); 9902 if (pt == heap->null_value()) return heap->undefined_value();
9907 return pt->GetElementWithReceiver(*this_handle, index); 9903 return pt->GetElementWithReceiver(*this_handle, index);
9908 } 9904 }
9909 9905
9910 9906
(...skipping 3050 matching lines...) Expand 10 before | Expand all | Expand 10 after
12961 if (break_point_objects()->IsUndefined()) return 0; 12957 if (break_point_objects()->IsUndefined()) return 0;
12962 // Single break point. 12958 // Single break point.
12963 if (!break_point_objects()->IsFixedArray()) return 1; 12959 if (!break_point_objects()->IsFixedArray()) return 1;
12964 // Multiple break points. 12960 // Multiple break points.
12965 return FixedArray::cast(break_point_objects())->length(); 12961 return FixedArray::cast(break_point_objects())->length();
12966 } 12962 }
12967 #endif // ENABLE_DEBUGGER_SUPPORT 12963 #endif // ENABLE_DEBUGGER_SUPPORT
12968 12964
12969 12965
12970 } } // namespace v8::internal 12966 } } // 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