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

Unified Diff: src/objects.cc

Issue 12328064: Remove duplication and unnecessary HandleScope from HasElement helper functions (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added test for StringWithCharacterAt Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index d9da23f363ed1e18e363ff3e79b0fe02d348cc29..526187e155769b137c807fdabc0271ed1a509906 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -3370,11 +3370,6 @@ PropertyAttributes JSObject::GetElementAttributeWithReceiver(
return GetElementAttributeWithInterceptor(receiver, index, continue_search);
}
- // Handle [] on String objects.
- if (this->IsStringObjectWithCharacterAt(index)) {
- return static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE);
- }
-
return GetElementAttributeWithoutInterceptor(
receiver, index, continue_search);
}
@@ -3426,28 +3421,25 @@ PropertyAttributes JSObject::GetElementAttributeWithInterceptor(
PropertyAttributes JSObject::GetElementAttributeWithoutInterceptor(
JSReceiver* receiver, uint32_t index, bool continue_search) {
- Isolate* isolate = GetIsolate();
- HandleScope scope(isolate);
- Handle<JSReceiver> hreceiver(receiver);
- Handle<JSObject> holder(this);
- PropertyAttributes attr = holder->GetElementsAccessor()->GetAttributes(
- *hreceiver, *holder, index);
+ PropertyAttributes attr = GetElementsAccessor()->GetAttributes(
+ receiver, this, index);
if (attr != ABSENT) return attr;
- if (holder->IsStringObjectWithCharacterAt(index)) {
+ // Handle [] on String objects.
+ if (IsStringObjectWithCharacterAt(index)) {
return static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE);
}
if (!continue_search) return ABSENT;
- Object* pt = holder->GetPrototype();
+ Object* pt = GetPrototype();
if (pt->IsJSProxy()) {
// We need to follow the spec and simulate a call to [[GetOwnProperty]].
- return JSProxy::cast(pt)->GetElementAttributeWithHandler(*hreceiver, index);
+ return JSProxy::cast(pt)->GetElementAttributeWithHandler(receiver, index);
}
if (pt->IsNull()) return ABSENT;
return JSObject::cast(pt)->GetElementAttributeWithReceiver(
- *hreceiver, index, true);
+ receiver, index, true);
}
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698