| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 | 561 |
| 562 ResourceConstraints::ResourceConstraints() | 562 ResourceConstraints::ResourceConstraints() |
| 563 : max_young_space_size_(0), | 563 : max_young_space_size_(0), |
| 564 max_old_space_size_(0), | 564 max_old_space_size_(0), |
| 565 max_executable_size_(0), | 565 max_executable_size_(0), |
| 566 stack_limit_(NULL) { } | 566 stack_limit_(NULL) { } |
| 567 | 567 |
| 568 | 568 |
| 569 bool SetResourceConstraints(ResourceConstraints* constraints) { | 569 bool SetResourceConstraints(ResourceConstraints* constraints) { |
| 570 i::Isolate* isolate = EnterIsolateIfNeeded(); | 570 i::Isolate* isolate = EnterIsolateIfNeeded(); |
| 571 return SetResourceConstraints(reinterpret_cast<Isolate*>(isolate), |
| 572 constraints); |
| 573 } |
| 571 | 574 |
| 575 |
| 576 bool SetResourceConstraints(Isolate* v8_isolate, |
| 577 ResourceConstraints* constraints) { |
| 578 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); |
| 572 int young_space_size = constraints->max_young_space_size(); | 579 int young_space_size = constraints->max_young_space_size(); |
| 573 int old_gen_size = constraints->max_old_space_size(); | 580 int old_gen_size = constraints->max_old_space_size(); |
| 574 int max_executable_size = constraints->max_executable_size(); | 581 int max_executable_size = constraints->max_executable_size(); |
| 575 if (young_space_size != 0 || old_gen_size != 0 || max_executable_size != 0) { | 582 if (young_space_size != 0 || old_gen_size != 0 || max_executable_size != 0) { |
| 576 // After initialization it's too late to change Heap constraints. | 583 // After initialization it's too late to change Heap constraints. |
| 577 ASSERT(!isolate->IsInitialized()); | 584 ASSERT(!isolate->IsInitialized()); |
| 578 bool result = isolate->heap()->ConfigureHeap(young_space_size / 2, | 585 bool result = isolate->heap()->ConfigureHeap(young_space_size / 2, |
| 579 old_gen_size, | 586 old_gen_size, |
| 580 max_executable_size); | 587 max_executable_size); |
| 581 if (!result) return false; | 588 if (!result) return false; |
| (...skipping 2540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3122 bool v8::Object::Set(v8::Handle<Value> key, v8::Handle<Value> value, | 3129 bool v8::Object::Set(v8::Handle<Value> key, v8::Handle<Value> value, |
| 3123 v8::PropertyAttribute attribs) { | 3130 v8::PropertyAttribute attribs) { |
| 3124 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3131 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3125 ON_BAILOUT(isolate, "v8::Object::Set()", return false); | 3132 ON_BAILOUT(isolate, "v8::Object::Set()", return false); |
| 3126 ENTER_V8(isolate); | 3133 ENTER_V8(isolate); |
| 3127 i::HandleScope scope(isolate); | 3134 i::HandleScope scope(isolate); |
| 3128 i::Handle<i::Object> self = Utils::OpenHandle(this); | 3135 i::Handle<i::Object> self = Utils::OpenHandle(this); |
| 3129 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); | 3136 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); |
| 3130 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value); | 3137 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value); |
| 3131 EXCEPTION_PREAMBLE(isolate); | 3138 EXCEPTION_PREAMBLE(isolate); |
| 3132 i::Handle<i::Object> obj = i::SetProperty( | 3139 i::Handle<i::Object> obj = i::Runtime::SetObjectProperty( |
| 3133 isolate, | 3140 isolate, |
| 3134 self, | 3141 self, |
| 3135 key_obj, | 3142 key_obj, |
| 3136 value_obj, | 3143 value_obj, |
| 3137 static_cast<PropertyAttributes>(attribs), | 3144 static_cast<PropertyAttributes>(attribs), |
| 3138 i::kNonStrictMode); | 3145 i::kNonStrictMode); |
| 3139 has_pending_exception = obj.is_null(); | 3146 has_pending_exception = obj.is_null(); |
| 3140 EXCEPTION_BAILOUT_CHECK(isolate, false); | 3147 EXCEPTION_BAILOUT_CHECK(isolate, false); |
| 3141 return true; | 3148 return true; |
| 3142 } | 3149 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3177 self, | 3184 self, |
| 3178 key_obj, | 3185 key_obj, |
| 3179 value_obj, | 3186 value_obj, |
| 3180 static_cast<PropertyAttributes>(attribs)); | 3187 static_cast<PropertyAttributes>(attribs)); |
| 3181 has_pending_exception = obj.is_null(); | 3188 has_pending_exception = obj.is_null(); |
| 3182 EXCEPTION_BAILOUT_CHECK(isolate, false); | 3189 EXCEPTION_BAILOUT_CHECK(isolate, false); |
| 3183 return true; | 3190 return true; |
| 3184 } | 3191 } |
| 3185 | 3192 |
| 3186 | 3193 |
| 3194 bool v8::Object::SetPrivate(v8::Handle<Private> key, v8::Handle<Value> value) { |
| 3195 return Set(v8::Handle<Value>(reinterpret_cast<Value*>(*key)), |
| 3196 value, DontEnum); |
| 3197 } |
| 3198 |
| 3199 |
| 3187 bool v8::Object::ForceDelete(v8::Handle<Value> key) { | 3200 bool v8::Object::ForceDelete(v8::Handle<Value> key) { |
| 3188 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3201 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3189 ON_BAILOUT(isolate, "v8::Object::ForceDelete()", return false); | 3202 ON_BAILOUT(isolate, "v8::Object::ForceDelete()", return false); |
| 3190 ENTER_V8(isolate); | 3203 ENTER_V8(isolate); |
| 3191 i::HandleScope scope(isolate); | 3204 i::HandleScope scope(isolate); |
| 3192 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 3205 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 3193 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); | 3206 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); |
| 3194 | 3207 |
| 3195 // When deleting a property on the global object using ForceDelete | 3208 // When deleting a property on the global object using ForceDelete |
| 3196 // deoptimize all functions as optimized code does not check for the hole | 3209 // deoptimize all functions as optimized code does not check for the hole |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3228 ENTER_V8(isolate); | 3241 ENTER_V8(isolate); |
| 3229 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 3242 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 3230 EXCEPTION_PREAMBLE(isolate); | 3243 EXCEPTION_PREAMBLE(isolate); |
| 3231 i::Handle<i::Object> result = i::Object::GetElement(isolate, self, index); | 3244 i::Handle<i::Object> result = i::Object::GetElement(isolate, self, index); |
| 3232 has_pending_exception = result.is_null(); | 3245 has_pending_exception = result.is_null(); |
| 3233 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>()); | 3246 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>()); |
| 3234 return Utils::ToLocal(result); | 3247 return Utils::ToLocal(result); |
| 3235 } | 3248 } |
| 3236 | 3249 |
| 3237 | 3250 |
| 3251 Local<Value> v8::Object::GetPrivate(v8::Handle<Private> key) { |
| 3252 return Get(v8::Handle<Value>(reinterpret_cast<Value*>(*key))); |
| 3253 } |
| 3254 |
| 3255 |
| 3238 PropertyAttribute v8::Object::GetPropertyAttributes(v8::Handle<Value> key) { | 3256 PropertyAttribute v8::Object::GetPropertyAttributes(v8::Handle<Value> key) { |
| 3239 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3257 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3240 ON_BAILOUT(isolate, "v8::Object::GetPropertyAttribute()", | 3258 ON_BAILOUT(isolate, "v8::Object::GetPropertyAttribute()", |
| 3241 return static_cast<PropertyAttribute>(NONE)); | 3259 return static_cast<PropertyAttribute>(NONE)); |
| 3242 ENTER_V8(isolate); | 3260 ENTER_V8(isolate); |
| 3243 i::HandleScope scope(isolate); | 3261 i::HandleScope scope(isolate); |
| 3244 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 3262 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 3245 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); | 3263 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); |
| 3246 if (!key_obj->IsName()) { | 3264 if (!key_obj->IsName()) { |
| 3247 EXCEPTION_PREAMBLE(isolate); | 3265 EXCEPTION_PREAMBLE(isolate); |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3427 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 3445 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 3428 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); | 3446 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); |
| 3429 EXCEPTION_PREAMBLE(isolate); | 3447 EXCEPTION_PREAMBLE(isolate); |
| 3430 i::Handle<i::Object> obj = i::DeleteProperty(self, key_obj); | 3448 i::Handle<i::Object> obj = i::DeleteProperty(self, key_obj); |
| 3431 has_pending_exception = obj.is_null(); | 3449 has_pending_exception = obj.is_null(); |
| 3432 EXCEPTION_BAILOUT_CHECK(isolate, false); | 3450 EXCEPTION_BAILOUT_CHECK(isolate, false); |
| 3433 return obj->IsTrue(); | 3451 return obj->IsTrue(); |
| 3434 } | 3452 } |
| 3435 | 3453 |
| 3436 | 3454 |
| 3455 bool v8::Object::DeletePrivate(v8::Handle<Private> key) { |
| 3456 return Delete(v8::Handle<Value>(reinterpret_cast<Value*>(*key))); |
| 3457 } |
| 3458 |
| 3459 |
| 3437 bool v8::Object::Has(v8::Handle<Value> key) { | 3460 bool v8::Object::Has(v8::Handle<Value> key) { |
| 3438 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3461 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3439 ON_BAILOUT(isolate, "v8::Object::Has()", return false); | 3462 ON_BAILOUT(isolate, "v8::Object::Has()", return false); |
| 3440 ENTER_V8(isolate); | 3463 ENTER_V8(isolate); |
| 3441 i::Handle<i::JSReceiver> self = Utils::OpenHandle(this); | 3464 i::Handle<i::JSReceiver> self = Utils::OpenHandle(this); |
| 3442 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); | 3465 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); |
| 3443 EXCEPTION_PREAMBLE(isolate); | 3466 EXCEPTION_PREAMBLE(isolate); |
| 3444 i::Handle<i::Object> obj = i::HasProperty(self, key_obj); | 3467 i::Handle<i::Object> obj = i::HasProperty(self, key_obj); |
| 3445 has_pending_exception = obj.is_null(); | 3468 has_pending_exception = obj.is_null(); |
| 3446 EXCEPTION_BAILOUT_CHECK(isolate, false); | 3469 EXCEPTION_BAILOUT_CHECK(isolate, false); |
| 3447 return obj->IsTrue(); | 3470 return obj->IsTrue(); |
| 3448 } | 3471 } |
| 3449 | 3472 |
| 3450 | 3473 |
| 3474 bool v8::Object::HasPrivate(v8::Handle<Private> key) { |
| 3475 return Has(v8::Handle<Value>(reinterpret_cast<Value*>(*key))); |
| 3476 } |
| 3477 |
| 3478 |
| 3451 bool v8::Object::Delete(uint32_t index) { | 3479 bool v8::Object::Delete(uint32_t index) { |
| 3452 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3480 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3453 ON_BAILOUT(isolate, "v8::Object::DeleteProperty()", | 3481 ON_BAILOUT(isolate, "v8::Object::DeleteProperty()", |
| 3454 return false); | 3482 return false); |
| 3455 ENTER_V8(isolate); | 3483 ENTER_V8(isolate); |
| 3456 HandleScope scope(reinterpret_cast<Isolate*>(isolate)); | 3484 HandleScope scope(reinterpret_cast<Isolate*>(isolate)); |
| 3457 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 3485 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 3458 return i::JSReceiver::DeleteElement(self, index)->IsTrue(); | 3486 return i::JSReceiver::DeleteElement(self, index)->IsTrue(); |
| 3459 } | 3487 } |
| 3460 | 3488 |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3681 return Utils::ToLocal(i::Handle<i::Context>(context)); | 3709 return Utils::ToLocal(i::Handle<i::Context>(context)); |
| 3682 } | 3710 } |
| 3683 | 3711 |
| 3684 | 3712 |
| 3685 int v8::Object::GetIdentityHash() { | 3713 int v8::Object::GetIdentityHash() { |
| 3686 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3714 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3687 ON_BAILOUT(isolate, "v8::Object::GetIdentityHash()", return 0); | 3715 ON_BAILOUT(isolate, "v8::Object::GetIdentityHash()", return 0); |
| 3688 ENTER_V8(isolate); | 3716 ENTER_V8(isolate); |
| 3689 i::HandleScope scope(isolate); | 3717 i::HandleScope scope(isolate); |
| 3690 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 3718 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 3691 return i::JSObject::GetIdentityHash(self); | 3719 return i::Handle<i::Smi>::cast( |
| 3720 i::JSReceiver::GetOrCreateIdentityHash(self))->value(); |
| 3692 } | 3721 } |
| 3693 | 3722 |
| 3694 | 3723 |
| 3695 bool v8::Object::SetHiddenValue(v8::Handle<v8::String> key, | 3724 bool v8::Object::SetHiddenValue(v8::Handle<v8::String> key, |
| 3696 v8::Handle<v8::Value> value) { | 3725 v8::Handle<v8::Value> value) { |
| 3697 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3726 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3698 ON_BAILOUT(isolate, "v8::Object::SetHiddenValue()", return false); | 3727 ON_BAILOUT(isolate, "v8::Object::SetHiddenValue()", return false); |
| 3699 if (value.IsEmpty()) return DeleteHiddenValue(key); | 3728 if (value.IsEmpty()) return DeleteHiddenValue(key); |
| 3700 ENTER_V8(isolate); | 3729 ENTER_V8(isolate); |
| 3701 i::HandleScope scope(isolate); | 3730 i::HandleScope scope(isolate); |
| (...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4861 } | 4890 } |
| 4862 | 4891 |
| 4863 | 4892 |
| 4864 Local<Value> Symbol::Name() const { | 4893 Local<Value> Symbol::Name() const { |
| 4865 i::Handle<i::Symbol> sym = Utils::OpenHandle(this); | 4894 i::Handle<i::Symbol> sym = Utils::OpenHandle(this); |
| 4866 i::Handle<i::Object> name(sym->name(), sym->GetIsolate()); | 4895 i::Handle<i::Object> name(sym->name(), sym->GetIsolate()); |
| 4867 return Utils::ToLocal(name); | 4896 return Utils::ToLocal(name); |
| 4868 } | 4897 } |
| 4869 | 4898 |
| 4870 | 4899 |
| 4900 Local<Value> Private::Name() const { |
| 4901 return reinterpret_cast<const Symbol*>(this)->Name(); |
| 4902 } |
| 4903 |
| 4904 |
| 4871 double Number::Value() const { | 4905 double Number::Value() const { |
| 4872 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 4906 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| 4873 return obj->Number(); | 4907 return obj->Number(); |
| 4874 } | 4908 } |
| 4875 | 4909 |
| 4876 | 4910 |
| 4877 bool Boolean::Value() const { | 4911 bool Boolean::Value() const { |
| 4878 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 4912 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| 4879 return obj->IsTrue(); | 4913 return obj->IsTrue(); |
| 4880 } | 4914 } |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5354 | 5388 |
| 5355 | 5389 |
| 5356 bool FunctionTemplate::HasInstance(v8::Handle<v8::Value> value) { | 5390 bool FunctionTemplate::HasInstance(v8::Handle<v8::Value> value) { |
| 5357 ON_BAILOUT(i::Isolate::Current(), "v8::FunctionTemplate::HasInstanceOf()", | 5391 ON_BAILOUT(i::Isolate::Current(), "v8::FunctionTemplate::HasInstanceOf()", |
| 5358 return false); | 5392 return false); |
| 5359 i::Object* obj = *Utils::OpenHandle(*value); | 5393 i::Object* obj = *Utils::OpenHandle(*value); |
| 5360 return obj->IsInstanceOf(*Utils::OpenHandle(this)); | 5394 return obj->IsInstanceOf(*Utils::OpenHandle(this)); |
| 5361 } | 5395 } |
| 5362 | 5396 |
| 5363 | 5397 |
| 5398 Local<External> v8::External::New(Isolate* isolate, void* value) { |
| 5399 STATIC_ASSERT(sizeof(value) == sizeof(i::Address)); |
| 5400 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 5401 EnsureInitializedForIsolate(i_isolate, "v8::External::New()"); |
| 5402 LOG_API(i_isolate, "External::New"); |
| 5403 ENTER_V8(i_isolate); |
| 5404 i::Handle<i::JSObject> external = i_isolate->factory()->NewExternal(value); |
| 5405 return Utils::ExternalToLocal(external); |
| 5406 } |
| 5407 |
| 5408 |
| 5364 Local<External> v8::External::New(void* value) { | 5409 Local<External> v8::External::New(void* value) { |
| 5365 STATIC_ASSERT(sizeof(value) == sizeof(i::Address)); | 5410 return v8::External::New(Isolate::GetCurrent(), value); |
| 5366 i::Isolate* isolate = i::Isolate::Current(); | |
| 5367 EnsureInitializedForIsolate(isolate, "v8::External::New()"); | |
| 5368 LOG_API(isolate, "External::New"); | |
| 5369 ENTER_V8(isolate); | |
| 5370 i::Handle<i::JSObject> external = isolate->factory()->NewExternal(value); | |
| 5371 return Utils::ExternalToLocal(external); | |
| 5372 } | 5411 } |
| 5373 | 5412 |
| 5374 | 5413 |
| 5375 void* External::Value() const { | 5414 void* External::Value() const { |
| 5376 return ExternalValue(*Utils::OpenHandle(this)); | 5415 return ExternalValue(*Utils::OpenHandle(this)); |
| 5377 } | 5416 } |
| 5378 | 5417 |
| 5379 | 5418 |
| 5380 Local<String> v8::String::Empty() { | 5419 Local<String> v8::String::Empty() { |
| 5381 i::Isolate* isolate = i::Isolate::Current(); | 5420 i::Isolate* isolate = i::Isolate::Current(); |
| (...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6118 LOG_API(isolate, "v8::DataView::New(void*, size_t, size_t)"); | 6157 LOG_API(isolate, "v8::DataView::New(void*, size_t, size_t)"); |
| 6119 ENTER_V8(isolate); | 6158 ENTER_V8(isolate); |
| 6120 i::Handle<i::JSDataView> obj = isolate->factory()->NewJSDataView(); | 6159 i::Handle<i::JSDataView> obj = isolate->factory()->NewJSDataView(); |
| 6121 i::Handle<i::JSArrayBuffer> buffer = Utils::OpenHandle(*array_buffer); | 6160 i::Handle<i::JSArrayBuffer> buffer = Utils::OpenHandle(*array_buffer); |
| 6122 SetupArrayBufferView( | 6161 SetupArrayBufferView( |
| 6123 isolate, obj, buffer, byte_offset, byte_length); | 6162 isolate, obj, buffer, byte_offset, byte_length); |
| 6124 return Utils::ToLocal(obj); | 6163 return Utils::ToLocal(obj); |
| 6125 } | 6164 } |
| 6126 | 6165 |
| 6127 | 6166 |
| 6128 Local<Symbol> v8::Symbol::New(Isolate* isolate) { | |
| 6129 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | |
| 6130 EnsureInitializedForIsolate(i_isolate, "v8::Symbol::New()"); | |
| 6131 LOG_API(i_isolate, "Symbol::New()"); | |
| 6132 ENTER_V8(i_isolate); | |
| 6133 i::Handle<i::Symbol> result = i_isolate->factory()->NewSymbol(); | |
| 6134 return Utils::ToLocal(result); | |
| 6135 } | |
| 6136 | |
| 6137 | |
| 6138 Local<Symbol> v8::Symbol::New(Isolate* isolate, const char* data, int length) { | 6167 Local<Symbol> v8::Symbol::New(Isolate* isolate, const char* data, int length) { |
| 6139 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 6168 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 6140 EnsureInitializedForIsolate(i_isolate, "v8::Symbol::New()"); | 6169 EnsureInitializedForIsolate(i_isolate, "v8::Symbol::New()"); |
| 6141 LOG_API(i_isolate, "Symbol::New(char)"); | 6170 LOG_API(i_isolate, "Symbol::New()"); |
| 6142 ENTER_V8(i_isolate); | 6171 ENTER_V8(i_isolate); |
| 6143 if (length == -1) length = i::StrLength(data); | |
| 6144 i::Handle<i::String> name = i_isolate->factory()->NewStringFromUtf8( | |
| 6145 i::Vector<const char>(data, length)); | |
| 6146 i::Handle<i::Symbol> result = i_isolate->factory()->NewSymbol(); | 6172 i::Handle<i::Symbol> result = i_isolate->factory()->NewSymbol(); |
| 6147 result->set_name(*name); | 6173 if (data != NULL) { |
| 6174 if (length == -1) length = i::StrLength(data); |
| 6175 i::Handle<i::String> name = i_isolate->factory()->NewStringFromUtf8( |
| 6176 i::Vector<const char>(data, length)); |
| 6177 result->set_name(*name); |
| 6178 } |
| 6148 return Utils::ToLocal(result); | 6179 return Utils::ToLocal(result); |
| 6149 } | 6180 } |
| 6150 | 6181 |
| 6151 | 6182 |
| 6183 Local<Private> v8::Private::New( |
| 6184 Isolate* isolate, const char* data, int length) { |
| 6185 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 6186 EnsureInitializedForIsolate(i_isolate, "v8::Private::New()"); |
| 6187 LOG_API(i_isolate, "Private::New()"); |
| 6188 ENTER_V8(i_isolate); |
| 6189 i::Handle<i::Symbol> symbol = i_isolate->factory()->NewPrivateSymbol(); |
| 6190 if (data != NULL) { |
| 6191 if (length == -1) length = i::StrLength(data); |
| 6192 i::Handle<i::String> name = i_isolate->factory()->NewStringFromUtf8( |
| 6193 i::Vector<const char>(data, length)); |
| 6194 symbol->set_name(*name); |
| 6195 } |
| 6196 Local<Symbol> result = Utils::ToLocal(symbol); |
| 6197 return v8::Handle<Private>(reinterpret_cast<Private*>(*result)); |
| 6198 } |
| 6199 |
| 6200 |
| 6152 Local<Number> v8::Number::New(double value) { | 6201 Local<Number> v8::Number::New(double value) { |
| 6153 i::Isolate* isolate = i::Isolate::Current(); | 6202 i::Isolate* isolate = i::Isolate::Current(); |
| 6154 EnsureInitializedForIsolate(isolate, "v8::Number::New()"); | 6203 EnsureInitializedForIsolate(isolate, "v8::Number::New()"); |
| 6155 return Number::New(reinterpret_cast<Isolate*>(isolate), value); | 6204 return Number::New(reinterpret_cast<Isolate*>(isolate), value); |
| 6156 } | 6205 } |
| 6157 | 6206 |
| 6158 | 6207 |
| 6159 Local<Number> v8::Number::New(Isolate* isolate, double value) { | 6208 Local<Number> v8::Number::New(Isolate* isolate, double value) { |
| 6160 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); | 6209 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 6161 ASSERT(internal_isolate->IsInitialized()); | 6210 ASSERT(internal_isolate->IsInitialized()); |
| (...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7570 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7619 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 7571 Address callback_address = | 7620 Address callback_address = |
| 7572 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7621 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 7573 VMState<EXTERNAL> state(isolate); | 7622 VMState<EXTERNAL> state(isolate); |
| 7574 ExternalCallbackScope call_scope(isolate, callback_address); | 7623 ExternalCallbackScope call_scope(isolate, callback_address); |
| 7575 callback(info); | 7624 callback(info); |
| 7576 } | 7625 } |
| 7577 | 7626 |
| 7578 | 7627 |
| 7579 } } // namespace v8::internal | 7628 } } // namespace v8::internal |
| OLD | NEW |