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

Unified Diff: src/runtime.cc

Issue 14425011: api: Object::CachedProperty Base URL: gh:v8/v8.git@master
Patch Set: use handles Created 7 years, 8 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
« src/objects.cc ('K') | « src/runtime.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 7ad66894fdd8ffe3770ba85ccd7a38c4ff9bb72f..e9b069b436ec766e179788e7d73c3c97c41730dc 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -4259,7 +4259,8 @@ MaybeObject* Runtime::GetObjectPropertyOrFail(
MaybeObject* Runtime::GetObjectProperty(Isolate* isolate,
Handle<Object> object,
- Handle<Object> key) {
+ Handle<Object> key,
+ LookupCache* cache) {
HandleScope scope(isolate);
if (object->IsUndefined() || object->IsNull()) {
@@ -4292,8 +4293,10 @@ MaybeObject* Runtime::GetObjectProperty(Isolate* isolate,
// the element if so.
if (name->AsArrayIndex(&index)) {
return GetElementOrCharAt(isolate, object, index);
- } else {
+ } else if (cache == NULL) {
return object->GetProperty(*name);
+ } else {
+ return cache->GetProperty(object, name);
}
}
@@ -4557,7 +4560,8 @@ MaybeObject* Runtime::SetObjectProperty(Isolate* isolate,
Handle<Object> key,
Handle<Object> value,
PropertyAttributes attr,
- StrictModeFlag strict_mode) {
+ StrictModeFlag strict_mode,
+ LookupCache* cache) {
SetPropertyMode set_mode = attr == NONE ? SET_PROPERTY : DEFINE_PROPERTY;
HandleScope scope(isolate);
@@ -4613,8 +4617,12 @@ MaybeObject* Runtime::SetObjectProperty(Isolate* isolate,
js_object, index, value, attr, strict_mode, set_mode);
} else {
if (name->IsString()) Handle<String>::cast(name)->TryFlatten();
- result = JSReceiver::SetProperty(
- js_object, name, value, attr, strict_mode);
+ if (cache == NULL || attr != NONE || strict_mode != kNonStrictMode) {
+ result = JSReceiver::SetProperty(
+ js_object, name, value, attr, strict_mode);
+ } else {
+ return cache->SetProperty(js_object, name, value);
+ }
}
if (result.is_null()) return Failure::Exception();
return *value;
« src/objects.cc ('K') | « src/runtime.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698