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

Side by Side Diff: src/objects.cc

Issue 40324: Allow hidden properties and implement GetIdentityHash (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 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/objects.h ('k') | test/cctest/test-api.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 5153 matching lines...) Expand 10 before | Expand all | Expand 10 after
5164 Smi::cast(JSArray::cast(this)->length())->value()) : 5164 Smi::cast(JSArray::cast(this)->length())->value()) :
5165 static_cast<uint32_t>(FixedArray::cast(elements())->length()); 5165 static_cast<uint32_t>(FixedArray::cast(elements())->length());
5166 return (index < length) && 5166 return (index < length) &&
5167 !FixedArray::cast(elements())->get(index)->IsTheHole(); 5167 !FixedArray::cast(elements())->get(index)->IsTheHole();
5168 } else { 5168 } else {
5169 return element_dictionary()->FindNumberEntry(index) != -1; 5169 return element_dictionary()->FindNumberEntry(index) != -1;
5170 } 5170 }
5171 } 5171 }
5172 5172
5173 5173
5174 Object* JSObject::GetHiddenProperties(bool create_if_needed) {
5175 String* key = Heap::hidden_symbol();
5176 if (!this->HasProperty(key)) {
5177 // Hidden properties object not found. Allocate a new hidden properties
5178 // object if requested. Otherwise return the undefined value.
5179 if (create_if_needed) {
5180 Object* obj = Heap::AllocateJSObject(
5181 Top::context()->global_context()->object_function());
5182 if (obj->IsFailure()) {
5183 return obj;
5184 }
5185 return this->SetProperty(key, obj, DONT_ENUM);
5186 } else {
5187 return Heap::undefined_value();
5188 }
5189 }
5190 return this->GetProperty(key);
5191 }
5192
5193
5174 bool JSObject::HasElementWithReceiver(JSObject* receiver, uint32_t index) { 5194 bool JSObject::HasElementWithReceiver(JSObject* receiver, uint32_t index) {
5175 // Check access rights if needed. 5195 // Check access rights if needed.
5176 if (IsAccessCheckNeeded() && 5196 if (IsAccessCheckNeeded() &&
5177 !Top::MayIndexedAccess(this, index, v8::ACCESS_HAS)) { 5197 !Top::MayIndexedAccess(this, index, v8::ACCESS_HAS)) {
5178 Top::ReportFailedAccessCheck(this, v8::ACCESS_HAS); 5198 Top::ReportFailedAccessCheck(this, v8::ACCESS_HAS);
5179 return false; 5199 return false;
5180 } 5200 }
5181 5201
5182 // Check for lookup interceptor 5202 // Check for lookup interceptor
5183 if (HasIndexedInterceptor()) { 5203 if (HasIndexedInterceptor()) {
(...skipping 2180 matching lines...) Expand 10 before | Expand all | Expand 10 after
7364 // No break point. 7384 // No break point.
7365 if (break_point_objects()->IsUndefined()) return 0; 7385 if (break_point_objects()->IsUndefined()) return 0;
7366 // Single beak point. 7386 // Single beak point.
7367 if (!break_point_objects()->IsFixedArray()) return 1; 7387 if (!break_point_objects()->IsFixedArray()) return 1;
7368 // Multiple break points. 7388 // Multiple break points.
7369 return FixedArray::cast(break_point_objects())->length(); 7389 return FixedArray::cast(break_point_objects())->length();
7370 } 7390 }
7371 7391
7372 7392
7373 } } // namespace v8::internal 7393 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698