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

Unified Diff: src/api.cc

Issue 14425011: api: Object::CachedProperty Base URL: gh:v8/v8.git@master
Patch Set: globalize reference 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
« no previous file with comments | « include/v8.h ('k') | src/handles.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 9ee23698cf6f578e76e5316c204b8ab17a40658c..71947f35f9fe3e626728e4ada1904f48e44ddf13 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -3072,6 +3072,31 @@ bool v8::Object::Set(uint32_t index, v8::Handle<Value> value) {
}
+bool v8::Object::Set(v8::Object::CachedProperty key,
+ v8::Handle<Value> value,
+ v8::PropertyAttribute attribs) {
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
+ ON_BAILOUT(isolate, "v8::Object::Set()", return false);
+ ENTER_V8(isolate);
+ i::HandleScope scope(isolate);
+ i::Handle<i::Object> self = Utils::OpenHandle(this);
+ i::Handle<i::Object> key_obj = Utils::OpenHandle(*key.key_);
+ i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
+ EXCEPTION_PREAMBLE(isolate);
+ i::Handle<i::Object> obj = i::SetProperty(
+ isolate,
+ self,
+ key_obj,
+ value_obj,
+ static_cast<PropertyAttributes>(attribs),
+ i::kNonStrictMode,
+ key.cache_);
+ has_pending_exception = obj.is_null();
+ EXCEPTION_BAILOUT_CHECK(isolate, false);
+ return true;
+}
+
+
bool v8::Object::ForceSet(v8::Handle<Value> key,
v8::Handle<Value> value,
v8::PropertyAttribute attribs) {
@@ -3145,6 +3170,24 @@ Local<Value> v8::Object::Get(uint32_t index) {
}
+Local<Value> v8::Object::Get(v8::Object::CachedProperty key) {
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
+ ON_BAILOUT(isolate, "v8::Object::Get()", return Local<v8::Value>());
+ ENTER_V8(isolate);
+ i::Handle<i::Object> self = Utils::OpenHandle(this);
+ i::Handle<i::Object> key_obj = Utils::OpenHandle(*key.key_);
+ EXCEPTION_PREAMBLE(isolate);
+ i::Handle<i::Object> result = i::GetProperty(isolate,
+ self,
+ key_obj,
+ key.cache_);
+ has_pending_exception = result.is_null();
+ EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>());
+
+ return Utils::ToLocal(result);
+}
+
+
PropertyAttribute v8::Object::GetPropertyAttributes(v8::Handle<Value> key) {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ON_BAILOUT(isolate, "v8::Object::GetPropertyAttribute()",
@@ -5494,6 +5537,13 @@ bool v8::String::CanMakeExternal() {
}
+v8::Object::CachedProperty::CachedProperty(v8::Handle<v8::String> key) {
+ i::Isolate* isolate = Utils::OpenHandle(*key)->GetIsolate();
+ key_ = Persistent<String>::New(reinterpret_cast<v8::Isolate*>(isolate), key);
+ cache_ = new i::LookupCache(isolate);
+}
+
+
Local<v8::Object> v8::Object::New() {
i::Isolate* isolate = i::Isolate::Current();
EnsureInitializedForIsolate(isolate, "v8::Object::New()");
« no previous file with comments | « include/v8.h ('k') | src/handles.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698