| 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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 } | 559 } |
| 560 | 560 |
| 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 void ResourceConstraints::ConfigureDefaults(uint64_t physical_memory) { |
| 570 const int lump_of_memory = (i::kPointerSize / 4) * i::MB; |
| 571 #if V8_OS_ANDROID |
| 572 // Android has higher physical memory requirements before raising the maximum |
| 573 // heap size limits since it has no swap space. |
| 574 const uint64_t low_limit = 512ul * i::MB; |
| 575 const uint64_t medium_limit = 1ul * i::GB; |
| 576 const uint64_t high_limit = 2ul * i::GB; |
| 577 #else |
| 578 const uint64_t low_limit = 512ul * i::MB; |
| 579 const uint64_t medium_limit = 768ul * i::MB; |
| 580 const uint64_t high_limit = 1ul * i::GB; |
| 581 #endif |
| 582 |
| 583 // The young_space_size should be a power of 2 and old_generation_size should |
| 584 // be a multiple of Page::kPageSize. |
| 585 if (physical_memory <= low_limit) { |
| 586 set_max_young_space_size(2 * lump_of_memory); |
| 587 set_max_old_space_size(128 * lump_of_memory); |
| 588 set_max_executable_size(96 * lump_of_memory); |
| 589 } else if (physical_memory <= medium_limit) { |
| 590 set_max_young_space_size(8 * lump_of_memory); |
| 591 set_max_old_space_size(256 * lump_of_memory); |
| 592 set_max_executable_size(192 * lump_of_memory); |
| 593 } else if (physical_memory <= high_limit) { |
| 594 set_max_young_space_size(16 * lump_of_memory); |
| 595 set_max_old_space_size(512 * lump_of_memory); |
| 596 set_max_executable_size(256 * lump_of_memory); |
| 597 } else { |
| 598 set_max_young_space_size(16 * lump_of_memory); |
| 599 set_max_old_space_size(700 * lump_of_memory); |
| 600 set_max_executable_size(256 * lump_of_memory); |
| 601 } |
| 602 } |
| 603 |
| 604 |
| 569 bool SetResourceConstraints(ResourceConstraints* constraints) { | 605 bool SetResourceConstraints(ResourceConstraints* constraints) { |
| 570 i::Isolate* isolate = EnterIsolateIfNeeded(); | 606 i::Isolate* isolate = EnterIsolateIfNeeded(); |
| 571 return SetResourceConstraints(reinterpret_cast<Isolate*>(isolate), | 607 return SetResourceConstraints(reinterpret_cast<Isolate*>(isolate), |
| 572 constraints); | 608 constraints); |
| 573 } | 609 } |
| 574 | 610 |
| 575 | 611 |
| 576 bool SetResourceConstraints(Isolate* v8_isolate, | 612 bool SetResourceConstraints(Isolate* v8_isolate, |
| 577 ResourceConstraints* constraints) { | 613 ResourceConstraints* constraints) { |
| 578 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); | 614 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); |
| (...skipping 2605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3184 self, | 3220 self, |
| 3185 key_obj, | 3221 key_obj, |
| 3186 value_obj, | 3222 value_obj, |
| 3187 static_cast<PropertyAttributes>(attribs)); | 3223 static_cast<PropertyAttributes>(attribs)); |
| 3188 has_pending_exception = obj.is_null(); | 3224 has_pending_exception = obj.is_null(); |
| 3189 EXCEPTION_BAILOUT_CHECK(isolate, false); | 3225 EXCEPTION_BAILOUT_CHECK(isolate, false); |
| 3190 return true; | 3226 return true; |
| 3191 } | 3227 } |
| 3192 | 3228 |
| 3193 | 3229 |
| 3230 bool v8::Object::SetPrivate(v8::Handle<Private> key, v8::Handle<Value> value) { |
| 3231 return Set(v8::Handle<Value>(reinterpret_cast<Value*>(*key)), |
| 3232 value, DontEnum); |
| 3233 } |
| 3234 |
| 3235 |
| 3194 bool v8::Object::ForceDelete(v8::Handle<Value> key) { | 3236 bool v8::Object::ForceDelete(v8::Handle<Value> key) { |
| 3195 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3237 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3196 ON_BAILOUT(isolate, "v8::Object::ForceDelete()", return false); | 3238 ON_BAILOUT(isolate, "v8::Object::ForceDelete()", return false); |
| 3197 ENTER_V8(isolate); | 3239 ENTER_V8(isolate); |
| 3198 i::HandleScope scope(isolate); | 3240 i::HandleScope scope(isolate); |
| 3199 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 3241 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 3200 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); | 3242 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); |
| 3201 | 3243 |
| 3202 // When deleting a property on the global object using ForceDelete | 3244 // When deleting a property on the global object using ForceDelete |
| 3203 // deoptimize all functions as optimized code does not check for the hole | 3245 // 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... |
| 3235 ENTER_V8(isolate); | 3277 ENTER_V8(isolate); |
| 3236 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 3278 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 3237 EXCEPTION_PREAMBLE(isolate); | 3279 EXCEPTION_PREAMBLE(isolate); |
| 3238 i::Handle<i::Object> result = i::Object::GetElement(isolate, self, index); | 3280 i::Handle<i::Object> result = i::Object::GetElement(isolate, self, index); |
| 3239 has_pending_exception = result.is_null(); | 3281 has_pending_exception = result.is_null(); |
| 3240 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>()); | 3282 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>()); |
| 3241 return Utils::ToLocal(result); | 3283 return Utils::ToLocal(result); |
| 3242 } | 3284 } |
| 3243 | 3285 |
| 3244 | 3286 |
| 3287 Local<Value> v8::Object::GetPrivate(v8::Handle<Private> key) { |
| 3288 return Get(v8::Handle<Value>(reinterpret_cast<Value*>(*key))); |
| 3289 } |
| 3290 |
| 3291 |
| 3245 PropertyAttribute v8::Object::GetPropertyAttributes(v8::Handle<Value> key) { | 3292 PropertyAttribute v8::Object::GetPropertyAttributes(v8::Handle<Value> key) { |
| 3246 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3293 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3247 ON_BAILOUT(isolate, "v8::Object::GetPropertyAttribute()", | 3294 ON_BAILOUT(isolate, "v8::Object::GetPropertyAttribute()", |
| 3248 return static_cast<PropertyAttribute>(NONE)); | 3295 return static_cast<PropertyAttribute>(NONE)); |
| 3249 ENTER_V8(isolate); | 3296 ENTER_V8(isolate); |
| 3250 i::HandleScope scope(isolate); | 3297 i::HandleScope scope(isolate); |
| 3251 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 3298 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 3252 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); | 3299 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); |
| 3253 if (!key_obj->IsName()) { | 3300 if (!key_obj->IsName()) { |
| 3254 EXCEPTION_PREAMBLE(isolate); | 3301 EXCEPTION_PREAMBLE(isolate); |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3434 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 3481 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 3435 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); | 3482 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); |
| 3436 EXCEPTION_PREAMBLE(isolate); | 3483 EXCEPTION_PREAMBLE(isolate); |
| 3437 i::Handle<i::Object> obj = i::DeleteProperty(self, key_obj); | 3484 i::Handle<i::Object> obj = i::DeleteProperty(self, key_obj); |
| 3438 has_pending_exception = obj.is_null(); | 3485 has_pending_exception = obj.is_null(); |
| 3439 EXCEPTION_BAILOUT_CHECK(isolate, false); | 3486 EXCEPTION_BAILOUT_CHECK(isolate, false); |
| 3440 return obj->IsTrue(); | 3487 return obj->IsTrue(); |
| 3441 } | 3488 } |
| 3442 | 3489 |
| 3443 | 3490 |
| 3491 bool v8::Object::DeletePrivate(v8::Handle<Private> key) { |
| 3492 return Delete(v8::Handle<Value>(reinterpret_cast<Value*>(*key))); |
| 3493 } |
| 3494 |
| 3495 |
| 3444 bool v8::Object::Has(v8::Handle<Value> key) { | 3496 bool v8::Object::Has(v8::Handle<Value> key) { |
| 3445 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3497 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3446 ON_BAILOUT(isolate, "v8::Object::Has()", return false); | 3498 ON_BAILOUT(isolate, "v8::Object::Has()", return false); |
| 3447 ENTER_V8(isolate); | 3499 ENTER_V8(isolate); |
| 3448 i::Handle<i::JSReceiver> self = Utils::OpenHandle(this); | 3500 i::Handle<i::JSReceiver> self = Utils::OpenHandle(this); |
| 3449 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); | 3501 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); |
| 3450 EXCEPTION_PREAMBLE(isolate); | 3502 EXCEPTION_PREAMBLE(isolate); |
| 3451 i::Handle<i::Object> obj = i::HasProperty(self, key_obj); | 3503 i::Handle<i::Object> obj = i::HasProperty(self, key_obj); |
| 3452 has_pending_exception = obj.is_null(); | 3504 has_pending_exception = obj.is_null(); |
| 3453 EXCEPTION_BAILOUT_CHECK(isolate, false); | 3505 EXCEPTION_BAILOUT_CHECK(isolate, false); |
| 3454 return obj->IsTrue(); | 3506 return obj->IsTrue(); |
| 3455 } | 3507 } |
| 3456 | 3508 |
| 3457 | 3509 |
| 3510 bool v8::Object::HasPrivate(v8::Handle<Private> key) { |
| 3511 return Has(v8::Handle<Value>(reinterpret_cast<Value*>(*key))); |
| 3512 } |
| 3513 |
| 3514 |
| 3458 bool v8::Object::Delete(uint32_t index) { | 3515 bool v8::Object::Delete(uint32_t index) { |
| 3459 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3516 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3460 ON_BAILOUT(isolate, "v8::Object::DeleteProperty()", | 3517 ON_BAILOUT(isolate, "v8::Object::DeleteProperty()", |
| 3461 return false); | 3518 return false); |
| 3462 ENTER_V8(isolate); | 3519 ENTER_V8(isolate); |
| 3463 HandleScope scope(reinterpret_cast<Isolate*>(isolate)); | 3520 HandleScope scope(reinterpret_cast<Isolate*>(isolate)); |
| 3464 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 3521 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 3465 return i::JSReceiver::DeleteElement(self, index)->IsTrue(); | 3522 return i::JSReceiver::DeleteElement(self, index)->IsTrue(); |
| 3466 } | 3523 } |
| 3467 | 3524 |
| (...skipping 1401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4869 } | 4926 } |
| 4870 | 4927 |
| 4871 | 4928 |
| 4872 Local<Value> Symbol::Name() const { | 4929 Local<Value> Symbol::Name() const { |
| 4873 i::Handle<i::Symbol> sym = Utils::OpenHandle(this); | 4930 i::Handle<i::Symbol> sym = Utils::OpenHandle(this); |
| 4874 i::Handle<i::Object> name(sym->name(), sym->GetIsolate()); | 4931 i::Handle<i::Object> name(sym->name(), sym->GetIsolate()); |
| 4875 return Utils::ToLocal(name); | 4932 return Utils::ToLocal(name); |
| 4876 } | 4933 } |
| 4877 | 4934 |
| 4878 | 4935 |
| 4936 Local<Value> Private::Name() const { |
| 4937 return reinterpret_cast<const Symbol*>(this)->Name(); |
| 4938 } |
| 4939 |
| 4940 |
| 4879 double Number::Value() const { | 4941 double Number::Value() const { |
| 4880 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 4942 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| 4881 return obj->Number(); | 4943 return obj->Number(); |
| 4882 } | 4944 } |
| 4883 | 4945 |
| 4884 | 4946 |
| 4885 bool Boolean::Value() const { | 4947 bool Boolean::Value() const { |
| 4886 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 4948 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| 4887 return obj->IsTrue(); | 4949 return obj->IsTrue(); |
| 4888 } | 4950 } |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5362 | 5424 |
| 5363 | 5425 |
| 5364 bool FunctionTemplate::HasInstance(v8::Handle<v8::Value> value) { | 5426 bool FunctionTemplate::HasInstance(v8::Handle<v8::Value> value) { |
| 5365 ON_BAILOUT(i::Isolate::Current(), "v8::FunctionTemplate::HasInstanceOf()", | 5427 ON_BAILOUT(i::Isolate::Current(), "v8::FunctionTemplate::HasInstanceOf()", |
| 5366 return false); | 5428 return false); |
| 5367 i::Object* obj = *Utils::OpenHandle(*value); | 5429 i::Object* obj = *Utils::OpenHandle(*value); |
| 5368 return obj->IsInstanceOf(*Utils::OpenHandle(this)); | 5430 return obj->IsInstanceOf(*Utils::OpenHandle(this)); |
| 5369 } | 5431 } |
| 5370 | 5432 |
| 5371 | 5433 |
| 5434 Local<External> v8::External::New(Isolate* isolate, void* value) { |
| 5435 STATIC_ASSERT(sizeof(value) == sizeof(i::Address)); |
| 5436 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 5437 EnsureInitializedForIsolate(i_isolate, "v8::External::New()"); |
| 5438 LOG_API(i_isolate, "External::New"); |
| 5439 ENTER_V8(i_isolate); |
| 5440 i::Handle<i::JSObject> external = i_isolate->factory()->NewExternal(value); |
| 5441 return Utils::ExternalToLocal(external); |
| 5442 } |
| 5443 |
| 5444 |
| 5372 Local<External> v8::External::New(void* value) { | 5445 Local<External> v8::External::New(void* value) { |
| 5373 STATIC_ASSERT(sizeof(value) == sizeof(i::Address)); | 5446 return v8::External::New(Isolate::GetCurrent(), value); |
| 5374 i::Isolate* isolate = i::Isolate::Current(); | |
| 5375 EnsureInitializedForIsolate(isolate, "v8::External::New()"); | |
| 5376 LOG_API(isolate, "External::New"); | |
| 5377 ENTER_V8(isolate); | |
| 5378 i::Handle<i::JSObject> external = isolate->factory()->NewExternal(value); | |
| 5379 return Utils::ExternalToLocal(external); | |
| 5380 } | 5447 } |
| 5381 | 5448 |
| 5382 | 5449 |
| 5383 void* External::Value() const { | 5450 void* External::Value() const { |
| 5384 return ExternalValue(*Utils::OpenHandle(this)); | 5451 return ExternalValue(*Utils::OpenHandle(this)); |
| 5385 } | 5452 } |
| 5386 | 5453 |
| 5387 | 5454 |
| 5388 Local<String> v8::String::Empty() { | 5455 Local<String> v8::String::Empty() { |
| 5389 i::Isolate* isolate = i::Isolate::Current(); | 5456 i::Isolate* isolate = i::Isolate::Current(); |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6058 i::ElementsKind elements_kind> | 6125 i::ElementsKind elements_kind> |
| 6059 i::Handle<i::JSTypedArray> NewTypedArray( | 6126 i::Handle<i::JSTypedArray> NewTypedArray( |
| 6060 i::Isolate* isolate, | 6127 i::Isolate* isolate, |
| 6061 Handle<ArrayBuffer> array_buffer, size_t byte_offset, size_t length) { | 6128 Handle<ArrayBuffer> array_buffer, size_t byte_offset, size_t length) { |
| 6062 i::Handle<i::JSTypedArray> obj = | 6129 i::Handle<i::JSTypedArray> obj = |
| 6063 isolate->factory()->NewJSTypedArray(array_type); | 6130 isolate->factory()->NewJSTypedArray(array_type); |
| 6064 i::Handle<i::JSArrayBuffer> buffer = Utils::OpenHandle(*array_buffer); | 6131 i::Handle<i::JSArrayBuffer> buffer = Utils::OpenHandle(*array_buffer); |
| 6065 | 6132 |
| 6066 ASSERT(byte_offset % sizeof(ElementType) == 0); | 6133 ASSERT(byte_offset % sizeof(ElementType) == 0); |
| 6067 | 6134 |
| 6135 CHECK(length <= (std::numeric_limits<size_t>::max() / sizeof(ElementType))); |
| 6136 size_t byte_length = length * sizeof(ElementType); |
| 6068 SetupArrayBufferView( | 6137 SetupArrayBufferView( |
| 6069 isolate, obj, buffer, byte_offset, length * sizeof(ElementType)); | 6138 isolate, obj, buffer, byte_offset, byte_length); |
| 6070 | 6139 |
| 6071 i::Handle<i::Object> length_object = | 6140 i::Handle<i::Object> length_object = |
| 6072 isolate->factory()->NewNumberFromSize(length); | 6141 isolate->factory()->NewNumberFromSize(length); |
| 6073 obj->set_length(*length_object); | 6142 obj->set_length(*length_object); |
| 6074 | 6143 |
| 6075 i::Handle<i::ExternalArray> elements = | 6144 i::Handle<i::ExternalArray> elements = |
| 6076 isolate->factory()->NewExternalArray( | 6145 isolate->factory()->NewExternalArray( |
| 6077 static_cast<int>(length), array_type, | 6146 static_cast<int>(length), array_type, |
| 6078 static_cast<uint8_t*>(buffer->backing_store()) + byte_offset); | 6147 static_cast<uint8_t*>(buffer->backing_store()) + byte_offset); |
| 6079 obj->set_elements(*elements); | 6148 obj->set_elements(*elements); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6126 LOG_API(isolate, "v8::DataView::New(void*, size_t, size_t)"); | 6195 LOG_API(isolate, "v8::DataView::New(void*, size_t, size_t)"); |
| 6127 ENTER_V8(isolate); | 6196 ENTER_V8(isolate); |
| 6128 i::Handle<i::JSDataView> obj = isolate->factory()->NewJSDataView(); | 6197 i::Handle<i::JSDataView> obj = isolate->factory()->NewJSDataView(); |
| 6129 i::Handle<i::JSArrayBuffer> buffer = Utils::OpenHandle(*array_buffer); | 6198 i::Handle<i::JSArrayBuffer> buffer = Utils::OpenHandle(*array_buffer); |
| 6130 SetupArrayBufferView( | 6199 SetupArrayBufferView( |
| 6131 isolate, obj, buffer, byte_offset, byte_length); | 6200 isolate, obj, buffer, byte_offset, byte_length); |
| 6132 return Utils::ToLocal(obj); | 6201 return Utils::ToLocal(obj); |
| 6133 } | 6202 } |
| 6134 | 6203 |
| 6135 | 6204 |
| 6136 Local<Symbol> v8::Symbol::New(Isolate* isolate) { | |
| 6137 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | |
| 6138 EnsureInitializedForIsolate(i_isolate, "v8::Symbol::New()"); | |
| 6139 LOG_API(i_isolate, "Symbol::New()"); | |
| 6140 ENTER_V8(i_isolate); | |
| 6141 i::Handle<i::Symbol> result = i_isolate->factory()->NewSymbol(); | |
| 6142 return Utils::ToLocal(result); | |
| 6143 } | |
| 6144 | |
| 6145 | |
| 6146 Local<Symbol> v8::Symbol::New(Isolate* isolate, const char* data, int length) { | 6205 Local<Symbol> v8::Symbol::New(Isolate* isolate, const char* data, int length) { |
| 6147 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 6206 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 6148 EnsureInitializedForIsolate(i_isolate, "v8::Symbol::New()"); | 6207 EnsureInitializedForIsolate(i_isolate, "v8::Symbol::New()"); |
| 6149 LOG_API(i_isolate, "Symbol::New(char)"); | 6208 LOG_API(i_isolate, "Symbol::New()"); |
| 6150 ENTER_V8(i_isolate); | 6209 ENTER_V8(i_isolate); |
| 6151 if (length == -1) length = i::StrLength(data); | |
| 6152 i::Handle<i::String> name = i_isolate->factory()->NewStringFromUtf8( | |
| 6153 i::Vector<const char>(data, length)); | |
| 6154 i::Handle<i::Symbol> result = i_isolate->factory()->NewSymbol(); | 6210 i::Handle<i::Symbol> result = i_isolate->factory()->NewSymbol(); |
| 6155 result->set_name(*name); | 6211 if (data != NULL) { |
| 6212 if (length == -1) length = i::StrLength(data); |
| 6213 i::Handle<i::String> name = i_isolate->factory()->NewStringFromUtf8( |
| 6214 i::Vector<const char>(data, length)); |
| 6215 result->set_name(*name); |
| 6216 } |
| 6156 return Utils::ToLocal(result); | 6217 return Utils::ToLocal(result); |
| 6157 } | 6218 } |
| 6158 | 6219 |
| 6159 | 6220 |
| 6221 Local<Private> v8::Private::New( |
| 6222 Isolate* isolate, const char* data, int length) { |
| 6223 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 6224 EnsureInitializedForIsolate(i_isolate, "v8::Private::New()"); |
| 6225 LOG_API(i_isolate, "Private::New()"); |
| 6226 ENTER_V8(i_isolate); |
| 6227 i::Handle<i::Symbol> symbol = i_isolate->factory()->NewPrivateSymbol(); |
| 6228 if (data != NULL) { |
| 6229 if (length == -1) length = i::StrLength(data); |
| 6230 i::Handle<i::String> name = i_isolate->factory()->NewStringFromUtf8( |
| 6231 i::Vector<const char>(data, length)); |
| 6232 symbol->set_name(*name); |
| 6233 } |
| 6234 Local<Symbol> result = Utils::ToLocal(symbol); |
| 6235 return v8::Handle<Private>(reinterpret_cast<Private*>(*result)); |
| 6236 } |
| 6237 |
| 6238 |
| 6160 Local<Number> v8::Number::New(double value) { | 6239 Local<Number> v8::Number::New(double value) { |
| 6161 i::Isolate* isolate = i::Isolate::Current(); | 6240 i::Isolate* isolate = i::Isolate::Current(); |
| 6162 EnsureInitializedForIsolate(isolate, "v8::Number::New()"); | 6241 EnsureInitializedForIsolate(isolate, "v8::Number::New()"); |
| 6163 return Number::New(reinterpret_cast<Isolate*>(isolate), value); | 6242 return Number::New(reinterpret_cast<Isolate*>(isolate), value); |
| 6164 } | 6243 } |
| 6165 | 6244 |
| 6166 | 6245 |
| 6167 Local<Number> v8::Number::New(Isolate* isolate, double value) { | 6246 Local<Number> v8::Number::New(Isolate* isolate, double value) { |
| 6168 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); | 6247 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 6169 ASSERT(internal_isolate->IsInitialized()); | 6248 ASSERT(internal_isolate->IsInitialized()); |
| (...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7578 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7657 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 7579 Address callback_address = | 7658 Address callback_address = |
| 7580 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7659 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 7581 VMState<EXTERNAL> state(isolate); | 7660 VMState<EXTERNAL> state(isolate); |
| 7582 ExternalCallbackScope call_scope(isolate, callback_address); | 7661 ExternalCallbackScope call_scope(isolate, callback_address); |
| 7583 callback(info); | 7662 callback(info); |
| 7584 } | 7663 } |
| 7585 | 7664 |
| 7586 | 7665 |
| 7587 } } // namespace v8::internal | 7666 } } // namespace v8::internal |
| OLD | NEW |