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

Side by Side Diff: src/api.cc

Issue 8050013: Move logic for hidden properties into the JSObject. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix typo. Created 9 years, 2 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 | « no previous file | src/handles.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 3192 matching lines...) Expand 10 before | Expand all | Expand 10 after
3203 } 3203 }
3204 3204
3205 3205
3206 bool v8::Object::SetHiddenValue(v8::Handle<v8::String> key, 3206 bool v8::Object::SetHiddenValue(v8::Handle<v8::String> key,
3207 v8::Handle<v8::Value> value) { 3207 v8::Handle<v8::Value> value) {
3208 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3208 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3209 ON_BAILOUT(isolate, "v8::Object::SetHiddenValue()", return false); 3209 ON_BAILOUT(isolate, "v8::Object::SetHiddenValue()", return false);
3210 ENTER_V8(isolate); 3210 ENTER_V8(isolate);
3211 i::HandleScope scope(isolate); 3211 i::HandleScope scope(isolate);
3212 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3212 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
3213 i::Handle<i::Object> hidden_props(i::GetHiddenProperties( 3213 i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
3214 self,
3215 i::ALLOW_CREATION));
3216 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
3217 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value); 3214 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
3218 EXCEPTION_PREAMBLE(isolate); 3215 i::Handle<i::Object> result = i::SetHiddenProperty(self, key_obj, value_obj);
3219 i::Handle<i::Object> obj = i::SetProperty( 3216 return *result == *self;
3220 hidden_props,
3221 key_obj,
3222 value_obj,
3223 static_cast<PropertyAttributes>(None),
3224 i::kNonStrictMode);
3225 has_pending_exception = obj.is_null();
3226 EXCEPTION_BAILOUT_CHECK(isolate, false);
3227 return true;
3228 } 3217 }
3229 3218
3230 3219
3231 v8::Local<v8::Value> v8::Object::GetHiddenValue(v8::Handle<v8::String> key) { 3220 v8::Local<v8::Value> v8::Object::GetHiddenValue(v8::Handle<v8::String> key) {
3232 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3221 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3233 ON_BAILOUT(isolate, "v8::Object::GetHiddenValue()", 3222 ON_BAILOUT(isolate, "v8::Object::GetHiddenValue()",
3234 return Local<v8::Value>()); 3223 return Local<v8::Value>());
3235 ENTER_V8(isolate); 3224 ENTER_V8(isolate);
3236 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3225 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
3237 i::Handle<i::Object> hidden_props(i::GetHiddenProperties(
3238 self,
3239 i::OMIT_CREATION));
3240 if (hidden_props->IsUndefined()) {
3241 return v8::Local<v8::Value>();
3242 }
3243 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); 3226 i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
3244 EXCEPTION_PREAMBLE(isolate); 3227 i::Handle<i::Object> result(self->GetHiddenProperty(*key_obj));
3245 i::Handle<i::Object> result = i::GetProperty(hidden_props, key_obj); 3228 if (result->IsUndefined()) return v8::Local<v8::Value>();
3246 has_pending_exception = result.is_null();
3247 EXCEPTION_BAILOUT_CHECK(isolate, v8::Local<v8::Value>());
3248 if (result->IsUndefined()) {
3249 return v8::Local<v8::Value>();
3250 }
3251 return Utils::ToLocal(result); 3229 return Utils::ToLocal(result);
3252 } 3230 }
3253 3231
3254 3232
3255 bool v8::Object::DeleteHiddenValue(v8::Handle<v8::String> key) { 3233 bool v8::Object::DeleteHiddenValue(v8::Handle<v8::String> key) {
3256 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3234 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3257 ON_BAILOUT(isolate, "v8::DeleteHiddenValue()", return false); 3235 ON_BAILOUT(isolate, "v8::DeleteHiddenValue()", return false);
3258 ENTER_V8(isolate); 3236 ENTER_V8(isolate);
3259 i::HandleScope scope(isolate); 3237 i::HandleScope scope(isolate);
3260 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3238 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
3261 i::Handle<i::Object> hidden_props(i::GetHiddenProperties(
3262 self,
3263 i::OMIT_CREATION));
3264 if (hidden_props->IsUndefined()) {
3265 return true;
3266 }
3267 i::Handle<i::JSObject> js_obj(i::JSObject::cast(*hidden_props));
3268 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); 3239 i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
3269 return i::DeleteProperty(js_obj, key_obj)->IsTrue(); 3240 self->DeleteHiddenProperty(*key_obj);
3241 return true;
3270 } 3242 }
3271 3243
3272 3244
3273 namespace { 3245 namespace {
3274 3246
3275 static i::ElementsKind GetElementsKindFromExternalArrayType( 3247 static i::ElementsKind GetElementsKindFromExternalArrayType(
3276 ExternalArrayType array_type) { 3248 ExternalArrayType array_type) {
3277 switch (array_type) { 3249 switch (array_type) {
3278 case kExternalByteArray: 3250 case kExternalByteArray:
3279 return i::EXTERNAL_BYTE_ELEMENTS; 3251 return i::EXTERNAL_BYTE_ELEMENTS;
(...skipping 2813 matching lines...) Expand 10 before | Expand all | Expand 10 after
6093 6065
6094 6066
6095 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 6067 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
6096 HandleScopeImplementer* scope_implementer = 6068 HandleScopeImplementer* scope_implementer =
6097 reinterpret_cast<HandleScopeImplementer*>(storage); 6069 reinterpret_cast<HandleScopeImplementer*>(storage);
6098 scope_implementer->IterateThis(v); 6070 scope_implementer->IterateThis(v);
6099 return storage + ArchiveSpacePerThread(); 6071 return storage + ArchiveSpacePerThread();
6100 } 6072 }
6101 6073
6102 } } // namespace v8::internal 6074 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/handles.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698