OLD | NEW |
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 3187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3198 | 3198 |
3199 bool v8::Object::SetHiddenValue(v8::Handle<v8::String> key, | 3199 bool v8::Object::SetHiddenValue(v8::Handle<v8::String> key, |
3200 v8::Handle<v8::Value> value) { | 3200 v8::Handle<v8::Value> value) { |
3201 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3201 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
3202 ON_BAILOUT(isolate, "v8::Object::SetHiddenValue()", return false); | 3202 ON_BAILOUT(isolate, "v8::Object::SetHiddenValue()", return false); |
3203 ENTER_V8(isolate); | 3203 ENTER_V8(isolate); |
3204 i::HandleScope scope(isolate); | 3204 i::HandleScope scope(isolate); |
3205 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 3205 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
3206 i::Handle<i::Object> hidden_props(i::GetHiddenProperties( | 3206 i::Handle<i::Object> hidden_props(i::GetHiddenProperties( |
3207 self, | 3207 self, |
3208 i::JSObject::ALLOW_CREATION)); | 3208 i::ALLOW_CREATION)); |
3209 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); | 3209 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); |
3210 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value); | 3210 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value); |
3211 EXCEPTION_PREAMBLE(isolate); | 3211 EXCEPTION_PREAMBLE(isolate); |
3212 i::Handle<i::Object> obj = i::SetProperty( | 3212 i::Handle<i::Object> obj = i::SetProperty( |
3213 hidden_props, | 3213 hidden_props, |
3214 key_obj, | 3214 key_obj, |
3215 value_obj, | 3215 value_obj, |
3216 static_cast<PropertyAttributes>(None), | 3216 static_cast<PropertyAttributes>(None), |
3217 i::kNonStrictMode); | 3217 i::kNonStrictMode); |
3218 has_pending_exception = obj.is_null(); | 3218 has_pending_exception = obj.is_null(); |
3219 EXCEPTION_BAILOUT_CHECK(isolate, false); | 3219 EXCEPTION_BAILOUT_CHECK(isolate, false); |
3220 return true; | 3220 return true; |
3221 } | 3221 } |
3222 | 3222 |
3223 | 3223 |
3224 v8::Local<v8::Value> v8::Object::GetHiddenValue(v8::Handle<v8::String> key) { | 3224 v8::Local<v8::Value> v8::Object::GetHiddenValue(v8::Handle<v8::String> key) { |
3225 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3225 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
3226 ON_BAILOUT(isolate, "v8::Object::GetHiddenValue()", | 3226 ON_BAILOUT(isolate, "v8::Object::GetHiddenValue()", |
3227 return Local<v8::Value>()); | 3227 return Local<v8::Value>()); |
3228 ENTER_V8(isolate); | 3228 ENTER_V8(isolate); |
3229 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 3229 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
3230 i::Handle<i::Object> hidden_props(i::GetHiddenProperties( | 3230 i::Handle<i::Object> hidden_props(i::GetHiddenProperties( |
3231 self, | 3231 self, |
3232 i::JSObject::OMIT_CREATION)); | 3232 i::OMIT_CREATION)); |
3233 if (hidden_props->IsUndefined()) { | 3233 if (hidden_props->IsUndefined()) { |
3234 return v8::Local<v8::Value>(); | 3234 return v8::Local<v8::Value>(); |
3235 } | 3235 } |
3236 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); | 3236 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); |
3237 EXCEPTION_PREAMBLE(isolate); | 3237 EXCEPTION_PREAMBLE(isolate); |
3238 i::Handle<i::Object> result = i::GetProperty(hidden_props, key_obj); | 3238 i::Handle<i::Object> result = i::GetProperty(hidden_props, key_obj); |
3239 has_pending_exception = result.is_null(); | 3239 has_pending_exception = result.is_null(); |
3240 EXCEPTION_BAILOUT_CHECK(isolate, v8::Local<v8::Value>()); | 3240 EXCEPTION_BAILOUT_CHECK(isolate, v8::Local<v8::Value>()); |
3241 if (result->IsUndefined()) { | 3241 if (result->IsUndefined()) { |
3242 return v8::Local<v8::Value>(); | 3242 return v8::Local<v8::Value>(); |
3243 } | 3243 } |
3244 return Utils::ToLocal(result); | 3244 return Utils::ToLocal(result); |
3245 } | 3245 } |
3246 | 3246 |
3247 | 3247 |
3248 bool v8::Object::DeleteHiddenValue(v8::Handle<v8::String> key) { | 3248 bool v8::Object::DeleteHiddenValue(v8::Handle<v8::String> key) { |
3249 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3249 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
3250 ON_BAILOUT(isolate, "v8::DeleteHiddenValue()", return false); | 3250 ON_BAILOUT(isolate, "v8::DeleteHiddenValue()", return false); |
3251 ENTER_V8(isolate); | 3251 ENTER_V8(isolate); |
3252 i::HandleScope scope(isolate); | 3252 i::HandleScope scope(isolate); |
3253 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 3253 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
3254 i::Handle<i::Object> hidden_props(i::GetHiddenProperties( | 3254 i::Handle<i::Object> hidden_props(i::GetHiddenProperties( |
3255 self, | 3255 self, |
3256 i::JSObject::OMIT_CREATION)); | 3256 i::OMIT_CREATION)); |
3257 if (hidden_props->IsUndefined()) { | 3257 if (hidden_props->IsUndefined()) { |
3258 return true; | 3258 return true; |
3259 } | 3259 } |
3260 i::Handle<i::JSObject> js_obj(i::JSObject::cast(*hidden_props)); | 3260 i::Handle<i::JSObject> js_obj(i::JSObject::cast(*hidden_props)); |
3261 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); | 3261 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); |
3262 return i::DeleteProperty(js_obj, key_obj)->IsTrue(); | 3262 return i::DeleteProperty(js_obj, key_obj)->IsTrue(); |
3263 } | 3263 } |
3264 | 3264 |
3265 | 3265 |
3266 namespace { | 3266 namespace { |
(...skipping 2769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6036 | 6036 |
6037 | 6037 |
6038 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 6038 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
6039 HandleScopeImplementer* scope_implementer = | 6039 HandleScopeImplementer* scope_implementer = |
6040 reinterpret_cast<HandleScopeImplementer*>(storage); | 6040 reinterpret_cast<HandleScopeImplementer*>(storage); |
6041 scope_implementer->IterateThis(v); | 6041 scope_implementer->IterateThis(v); |
6042 return storage + ArchiveSpacePerThread(); | 6042 return storage + ArchiveSpacePerThread(); |
6043 } | 6043 } |
6044 | 6044 |
6045 } } // namespace v8::internal | 6045 } } // namespace v8::internal |
OLD | NEW |