| 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 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 878 static void TemplateSet(i::Isolate* isolate, | 878 static void TemplateSet(i::Isolate* isolate, |
| 879 v8::Template* templ, | 879 v8::Template* templ, |
| 880 int length, | 880 int length, |
| 881 v8::Handle<v8::Data>* data) { | 881 v8::Handle<v8::Data>* data) { |
| 882 i::Handle<i::Object> list(Utils::OpenHandle(templ)->property_list(), isolate); | 882 i::Handle<i::Object> list(Utils::OpenHandle(templ)->property_list(), isolate); |
| 883 if (list->IsUndefined()) { | 883 if (list->IsUndefined()) { |
| 884 list = NeanderArray().value(); | 884 list = NeanderArray().value(); |
| 885 Utils::OpenHandle(templ)->set_property_list(*list); | 885 Utils::OpenHandle(templ)->set_property_list(*list); |
| 886 } | 886 } |
| 887 NeanderArray array(list); | 887 NeanderArray array(list); |
| 888 array.add(Utils::OpenHandle(*v8::Integer::New(length))); | 888 array.add(isolate->factory()->NewNumberFromInt(length)); |
| 889 for (int i = 0; i < length; i++) { | 889 for (int i = 0; i < length; i++) { |
| 890 i::Handle<i::Object> value = data[i].IsEmpty() ? | 890 i::Handle<i::Object> value = data[i].IsEmpty() ? |
| 891 i::Handle<i::Object>(isolate->factory()->undefined_value()) : | 891 i::Handle<i::Object>(isolate->factory()->undefined_value()) : |
| 892 Utils::OpenHandle(*data[i]); | 892 Utils::OpenHandle(*data[i]); |
| 893 array.add(value); | 893 array.add(value); |
| 894 } | 894 } |
| 895 } | 895 } |
| 896 | 896 |
| 897 | 897 |
| 898 void Template::Set(v8::Handle<String> name, | 898 void Template::Set(v8::Handle<String> name, |
| 899 v8::Handle<Data> value, | 899 v8::Handle<Data> value, |
| 900 v8::PropertyAttribute attribute) { | 900 v8::PropertyAttribute attribute) { |
| 901 i::Isolate* isolate = i::Isolate::Current(); | 901 i::Isolate* isolate = i::Isolate::Current(); |
| 902 ENTER_V8(isolate); | 902 ENTER_V8(isolate); |
| 903 i::HandleScope scope(isolate); | 903 i::HandleScope scope(isolate); |
| 904 const int kSize = 3; | 904 const int kSize = 3; |
| 905 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); |
| 905 v8::Handle<v8::Data> data[kSize] = { | 906 v8::Handle<v8::Data> data[kSize] = { |
| 906 name, | 907 name, |
| 907 value, | 908 value, |
| 908 v8::Integer::New(attribute)}; | 909 v8::Integer::New(v8_isolate, attribute)}; |
| 909 TemplateSet(isolate, this, kSize, data); | 910 TemplateSet(isolate, this, kSize, data); |
| 910 } | 911 } |
| 911 | 912 |
| 912 | 913 |
| 913 void Template::SetAccessorProperty( | 914 void Template::SetAccessorProperty( |
| 914 v8::Local<v8::String> name, | 915 v8::Local<v8::String> name, |
| 915 v8::Local<FunctionTemplate> getter, | 916 v8::Local<FunctionTemplate> getter, |
| 916 v8::Local<FunctionTemplate> setter, | 917 v8::Local<FunctionTemplate> setter, |
| 917 v8::PropertyAttribute attribute, | 918 v8::PropertyAttribute attribute, |
| 918 v8::AccessControl access_control) { | 919 v8::AccessControl access_control) { |
| 919 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 920 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 920 ENTER_V8(isolate); | 921 ENTER_V8(isolate); |
| 921 ASSERT(!name.IsEmpty()); | 922 ASSERT(!name.IsEmpty()); |
| 922 ASSERT(!getter.IsEmpty() || !setter.IsEmpty()); | 923 ASSERT(!getter.IsEmpty() || !setter.IsEmpty()); |
| 923 i::HandleScope scope(isolate); | 924 i::HandleScope scope(isolate); |
| 924 const int kSize = 5; | 925 const int kSize = 5; |
| 926 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); |
| 925 v8::Handle<v8::Data> data[kSize] = { | 927 v8::Handle<v8::Data> data[kSize] = { |
| 926 name, | 928 name, |
| 927 getter, | 929 getter, |
| 928 setter, | 930 setter, |
| 929 v8::Integer::New(attribute), | 931 v8::Integer::New(v8_isolate, attribute), |
| 930 v8::Integer::New(access_control)}; | 932 v8::Integer::New(v8_isolate, access_control)}; |
| 931 TemplateSet(isolate, this, kSize, data); | 933 TemplateSet(isolate, this, kSize, data); |
| 932 } | 934 } |
| 933 | 935 |
| 934 | 936 |
| 935 // --- F u n c t i o n T e m p l a t e --- | 937 // --- F u n c t i o n T e m p l a t e --- |
| 936 static void InitializeFunctionTemplate( | 938 static void InitializeFunctionTemplate( |
| 937 i::Handle<i::FunctionTemplateInfo> info) { | 939 i::Handle<i::FunctionTemplateInfo> info) { |
| 938 info->set_tag(i::Smi::FromInt(Consts::FUNCTION_TEMPLATE)); | 940 info->set_tag(i::Smi::FromInt(Consts::FUNCTION_TEMPLATE)); |
| 939 info->set_flag(0); | 941 info->set_flag(0); |
| 940 } | 942 } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1001 int length) { | 1003 int length) { |
| 1002 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 1004 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 1003 EnsureInitializedForIsolate(i_isolate, "v8::FunctionTemplate::New()"); | 1005 EnsureInitializedForIsolate(i_isolate, "v8::FunctionTemplate::New()"); |
| 1004 LOG_API(i_isolate, "FunctionTemplate::New"); | 1006 LOG_API(i_isolate, "FunctionTemplate::New"); |
| 1005 ENTER_V8(i_isolate); | 1007 ENTER_V8(i_isolate); |
| 1006 return FunctionTemplateNew( | 1008 return FunctionTemplateNew( |
| 1007 i_isolate, callback, data, signature, length, false); | 1009 i_isolate, callback, data, signature, length, false); |
| 1008 } | 1010 } |
| 1009 | 1011 |
| 1010 | 1012 |
| 1011 Local<FunctionTemplate> FunctionTemplate::New( | |
| 1012 FunctionCallback callback, | |
| 1013 v8::Handle<Value> data, | |
| 1014 v8::Handle<Signature> signature, | |
| 1015 int length) { | |
| 1016 return New(Isolate::GetCurrent(), callback, data, signature, length); | |
| 1017 } | |
| 1018 | |
| 1019 Local<Signature> Signature::New(Isolate* isolate, | 1013 Local<Signature> Signature::New(Isolate* isolate, |
| 1020 Handle<FunctionTemplate> receiver, int argc, | 1014 Handle<FunctionTemplate> receiver, int argc, |
| 1021 Handle<FunctionTemplate> argv[]) { | 1015 Handle<FunctionTemplate> argv[]) { |
| 1022 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 1016 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 1023 EnsureInitializedForIsolate(i_isolate, "v8::Signature::New()"); | 1017 EnsureInitializedForIsolate(i_isolate, "v8::Signature::New()"); |
| 1024 LOG_API(i_isolate, "Signature::New"); | 1018 LOG_API(i_isolate, "Signature::New"); |
| 1025 ENTER_V8(i_isolate); | 1019 ENTER_V8(i_isolate); |
| 1026 i::Handle<i::Struct> struct_obj = | 1020 i::Handle<i::Struct> struct_obj = |
| 1027 i_isolate->factory()->NewStruct(i::SIGNATURE_INFO_TYPE); | 1021 i_isolate->factory()->NewStruct(i::SIGNATURE_INFO_TYPE); |
| 1028 i::Handle<i::SignatureInfo> obj = | 1022 i::Handle<i::SignatureInfo> obj = |
| (...skipping 3080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4109 } | 4103 } |
| 4110 return ToApiHandle<Primitive>(isolate->factory()->undefined_value()); | 4104 return ToApiHandle<Primitive>(isolate->factory()->undefined_value()); |
| 4111 } | 4105 } |
| 4112 | 4106 |
| 4113 | 4107 |
| 4114 ScriptOrigin Function::GetScriptOrigin() const { | 4108 ScriptOrigin Function::GetScriptOrigin() const { |
| 4115 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); | 4109 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); |
| 4116 if (func->shared()->script()->IsScript()) { | 4110 if (func->shared()->script()->IsScript()) { |
| 4117 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); | 4111 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); |
| 4118 i::Handle<i::Object> scriptName = GetScriptNameOrSourceURL(script); | 4112 i::Handle<i::Object> scriptName = GetScriptNameOrSourceURL(script); |
| 4113 v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(func->GetIsolate()); |
| 4119 v8::ScriptOrigin origin( | 4114 v8::ScriptOrigin origin( |
| 4120 Utils::ToLocal(scriptName), | 4115 Utils::ToLocal(scriptName), |
| 4121 v8::Integer::New(script->line_offset()->value()), | 4116 v8::Integer::New(isolate, script->line_offset()->value()), |
| 4122 v8::Integer::New(script->column_offset()->value())); | 4117 v8::Integer::New(isolate, script->column_offset()->value())); |
| 4123 return origin; | 4118 return origin; |
| 4124 } | 4119 } |
| 4125 return v8::ScriptOrigin(Handle<Value>()); | 4120 return v8::ScriptOrigin(Handle<Value>()); |
| 4126 } | 4121 } |
| 4127 | 4122 |
| 4128 | 4123 |
| 4129 const int Function::kLineOffsetNotFound = -1; | 4124 const int Function::kLineOffsetNotFound = -1; |
| 4130 | 4125 |
| 4131 | 4126 |
| 4132 int Function::GetScriptLineNumber() const { | 4127 int Function::GetScriptLineNumber() const { |
| (...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5343 i::Handle<i::JSObject> external = i_isolate->factory()->NewExternal(value); | 5338 i::Handle<i::JSObject> external = i_isolate->factory()->NewExternal(value); |
| 5344 return Utils::ExternalToLocal(external); | 5339 return Utils::ExternalToLocal(external); |
| 5345 } | 5340 } |
| 5346 | 5341 |
| 5347 | 5342 |
| 5348 void* External::Value() const { | 5343 void* External::Value() const { |
| 5349 return ExternalValue(*Utils::OpenHandle(this)); | 5344 return ExternalValue(*Utils::OpenHandle(this)); |
| 5350 } | 5345 } |
| 5351 | 5346 |
| 5352 | 5347 |
| 5353 Local<String> v8::String::Empty() { | |
| 5354 i::Isolate* isolate = i::Isolate::Current(); | |
| 5355 if (!EnsureInitializedForIsolate(isolate, "v8::String::Empty()")) { | |
| 5356 return v8::Local<String>(); | |
| 5357 } | |
| 5358 LOG_API(isolate, "String::Empty()"); | |
| 5359 return Utils::ToLocal(isolate->factory()->empty_string()); | |
| 5360 } | |
| 5361 | |
| 5362 | |
| 5363 // anonymous namespace for string creation helper functions | 5348 // anonymous namespace for string creation helper functions |
| 5364 namespace { | 5349 namespace { |
| 5365 | 5350 |
| 5366 inline int StringLength(const char* string) { | 5351 inline int StringLength(const char* string) { |
| 5367 return i::StrLength(string); | 5352 return i::StrLength(string); |
| 5368 } | 5353 } |
| 5369 | 5354 |
| 5370 | 5355 |
| 5371 inline int StringLength(const uint8_t* string) { | 5356 inline int StringLength(const uint8_t* string) { |
| 5372 return i::StrLength(reinterpret_cast<const char*>(string)); | 5357 return i::StrLength(reinterpret_cast<const char*>(string)); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5415 inline Local<String> NewString(Isolate* v8_isolate, | 5400 inline Local<String> NewString(Isolate* v8_isolate, |
| 5416 const char* location, | 5401 const char* location, |
| 5417 const char* env, | 5402 const char* env, |
| 5418 const Char* data, | 5403 const Char* data, |
| 5419 String::NewStringType type, | 5404 String::NewStringType type, |
| 5420 int length) { | 5405 int length) { |
| 5421 i::Isolate* isolate = reinterpret_cast<internal::Isolate*>(v8_isolate); | 5406 i::Isolate* isolate = reinterpret_cast<internal::Isolate*>(v8_isolate); |
| 5422 EnsureInitializedForIsolate(isolate, location); | 5407 EnsureInitializedForIsolate(isolate, location); |
| 5423 LOG_API(isolate, env); | 5408 LOG_API(isolate, env); |
| 5424 if (length == 0 && type != String::kUndetectableString) { | 5409 if (length == 0 && type != String::kUndetectableString) { |
| 5425 return String::Empty(); | 5410 return String::Empty(v8_isolate); |
| 5426 } | 5411 } |
| 5427 ENTER_V8(isolate); | 5412 ENTER_V8(isolate); |
| 5428 if (length == -1) length = StringLength(data); | 5413 if (length == -1) length = StringLength(data); |
| 5429 i::Handle<i::String> result = NewString( | 5414 i::Handle<i::String> result = NewString( |
| 5430 isolate->factory(), type, i::Vector<const Char>(data, length)); | 5415 isolate->factory(), type, i::Vector<const Char>(data, length)); |
| 5431 if (type == String::kUndetectableString) { | 5416 if (type == String::kUndetectableString) { |
| 5432 result->MarkAsUndetectable(); | 5417 result->MarkAsUndetectable(); |
| 5433 } | 5418 } |
| 5434 return Utils::ToLocal(result); | 5419 return Utils::ToLocal(result); |
| 5435 } | 5420 } |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5646 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 5631 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 5647 EnsureInitializedForIsolate(i_isolate, "v8::Object::New()"); | 5632 EnsureInitializedForIsolate(i_isolate, "v8::Object::New()"); |
| 5648 LOG_API(i_isolate, "Object::New"); | 5633 LOG_API(i_isolate, "Object::New"); |
| 5649 ENTER_V8(i_isolate); | 5634 ENTER_V8(i_isolate); |
| 5650 i::Handle<i::JSObject> obj = | 5635 i::Handle<i::JSObject> obj = |
| 5651 i_isolate->factory()->NewJSObject(i_isolate->object_function()); | 5636 i_isolate->factory()->NewJSObject(i_isolate->object_function()); |
| 5652 return Utils::ToLocal(obj); | 5637 return Utils::ToLocal(obj); |
| 5653 } | 5638 } |
| 5654 | 5639 |
| 5655 | 5640 |
| 5656 Local<v8::Object> v8::Object::New() { | |
| 5657 return New(Isolate::GetCurrent()); | |
| 5658 } | |
| 5659 | |
| 5660 | |
| 5661 Local<v8::Value> v8::NumberObject::New(Isolate* isolate, double value) { | 5641 Local<v8::Value> v8::NumberObject::New(Isolate* isolate, double value) { |
| 5662 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 5642 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 5663 EnsureInitializedForIsolate(i_isolate, "v8::NumberObject::New()"); | 5643 EnsureInitializedForIsolate(i_isolate, "v8::NumberObject::New()"); |
| 5664 LOG_API(i_isolate, "NumberObject::New"); | 5644 LOG_API(i_isolate, "NumberObject::New"); |
| 5665 ENTER_V8(i_isolate); | 5645 ENTER_V8(i_isolate); |
| 5666 i::Handle<i::Object> number = i_isolate->factory()->NewNumber(value); | 5646 i::Handle<i::Object> number = i_isolate->factory()->NewNumber(value); |
| 5667 i::Handle<i::Object> obj = i_isolate->factory()->ToObject(number); | 5647 i::Handle<i::Object> obj = i_isolate->factory()->ToObject(number); |
| 5668 return Utils::ToLocal(obj); | 5648 return Utils::ToLocal(obj); |
| 5669 } | 5649 } |
| 5670 | 5650 |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6136 if (length == -1) length = i::StrLength(data); | 6116 if (length == -1) length = i::StrLength(data); |
| 6137 i::Handle<i::String> name = i_isolate->factory()->NewStringFromUtf8( | 6117 i::Handle<i::String> name = i_isolate->factory()->NewStringFromUtf8( |
| 6138 i::Vector<const char>(data, length)); | 6118 i::Vector<const char>(data, length)); |
| 6139 symbol->set_name(*name); | 6119 symbol->set_name(*name); |
| 6140 } | 6120 } |
| 6141 Local<Symbol> result = Utils::ToLocal(symbol); | 6121 Local<Symbol> result = Utils::ToLocal(symbol); |
| 6142 return v8::Handle<Private>(reinterpret_cast<Private*>(*result)); | 6122 return v8::Handle<Private>(reinterpret_cast<Private*>(*result)); |
| 6143 } | 6123 } |
| 6144 | 6124 |
| 6145 | 6125 |
| 6146 Local<Number> v8::Number::New(double value) { | |
| 6147 i::Isolate* isolate = i::Isolate::Current(); | |
| 6148 EnsureInitializedForIsolate(isolate, "v8::Number::New()"); | |
| 6149 return Number::New(reinterpret_cast<Isolate*>(isolate), value); | |
| 6150 } | |
| 6151 | |
| 6152 | |
| 6153 Local<Number> v8::Number::New(Isolate* isolate, double value) { | 6126 Local<Number> v8::Number::New(Isolate* isolate, double value) { |
| 6154 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); | 6127 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 6155 ASSERT(internal_isolate->IsInitialized()); | 6128 ASSERT(internal_isolate->IsInitialized()); |
| 6156 if (std::isnan(value)) { | 6129 if (std::isnan(value)) { |
| 6157 // Introduce only canonical NaN value into the VM, to avoid signaling NaNs. | 6130 // Introduce only canonical NaN value into the VM, to avoid signaling NaNs. |
| 6158 value = i::OS::nan_value(); | 6131 value = i::OS::nan_value(); |
| 6159 } | 6132 } |
| 6160 ENTER_V8(internal_isolate); | 6133 ENTER_V8(internal_isolate); |
| 6161 i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value); | 6134 i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value); |
| 6162 return Utils::NumberToLocal(result); | 6135 return Utils::NumberToLocal(result); |
| 6163 } | 6136 } |
| 6164 | 6137 |
| 6165 | 6138 |
| 6166 Local<Integer> v8::Integer::New(int32_t value) { | |
| 6167 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); | |
| 6168 EnsureInitializedForIsolate(isolate, "v8::Integer::New()"); | |
| 6169 return v8::Integer::New(reinterpret_cast<Isolate*>(isolate), value); | |
| 6170 } | |
| 6171 | |
| 6172 | |
| 6173 Local<Integer> Integer::NewFromUnsigned(uint32_t value) { | |
| 6174 i::Isolate* isolate = i::Isolate::Current(); | |
| 6175 EnsureInitializedForIsolate(isolate, "v8::Integer::NewFromUnsigned()"); | |
| 6176 return Integer::NewFromUnsigned(reinterpret_cast<Isolate*>(isolate), value); | |
| 6177 } | |
| 6178 | |
| 6179 | |
| 6180 Local<Integer> v8::Integer::New(int32_t value, Isolate* isolate) { | |
| 6181 return Integer::New(isolate, value); | |
| 6182 } | |
| 6183 | |
| 6184 | |
| 6185 Local<Integer> v8::Integer::NewFromUnsigned(uint32_t value, Isolate* isolate) { | |
| 6186 return Integer::NewFromUnsigned(isolate, value); | |
| 6187 } | |
| 6188 | |
| 6189 | |
| 6190 Local<Integer> v8::Integer::New(Isolate* isolate, int32_t value) { | 6139 Local<Integer> v8::Integer::New(Isolate* isolate, int32_t value) { |
| 6191 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); | 6140 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 6192 ASSERT(internal_isolate->IsInitialized()); | 6141 ASSERT(internal_isolate->IsInitialized()); |
| 6193 if (i::Smi::IsValid(value)) { | 6142 if (i::Smi::IsValid(value)) { |
| 6194 return Utils::IntegerToLocal(i::Handle<i::Object>(i::Smi::FromInt(value), | 6143 return Utils::IntegerToLocal(i::Handle<i::Object>(i::Smi::FromInt(value), |
| 6195 internal_isolate)); | 6144 internal_isolate)); |
| 6196 } | 6145 } |
| 6197 ENTER_V8(internal_isolate); | 6146 ENTER_V8(internal_isolate); |
| 6198 i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value); | 6147 i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value); |
| 6199 return Utils::IntegerToLocal(result); | 6148 return Utils::IntegerToLocal(result); |
| 6200 } | 6149 } |
| 6201 | 6150 |
| 6202 | 6151 |
| 6203 Local<Integer> v8::Integer::NewFromUnsigned(Isolate* isolate, uint32_t value) { | 6152 Local<Integer> v8::Integer::NewFromUnsigned(Isolate* isolate, uint32_t value) { |
| 6204 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); | 6153 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 6205 ASSERT(internal_isolate->IsInitialized()); | 6154 ASSERT(internal_isolate->IsInitialized()); |
| 6206 bool fits_into_int32_t = (value & (1 << 31)) == 0; | 6155 bool fits_into_int32_t = (value & (1 << 31)) == 0; |
| 6207 if (fits_into_int32_t) { | 6156 if (fits_into_int32_t) { |
| 6208 return Integer::New(static_cast<int32_t>(value), isolate); | 6157 return Integer::New(isolate, static_cast<int32_t>(value)); |
| 6209 } | 6158 } |
| 6210 ENTER_V8(internal_isolate); | 6159 ENTER_V8(internal_isolate); |
| 6211 i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value); | 6160 i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value); |
| 6212 return Utils::IntegerToLocal(result); | 6161 return Utils::IntegerToLocal(result); |
| 6213 } | 6162 } |
| 6214 | 6163 |
| 6215 | 6164 |
| 6216 #ifdef DEBUG | 6165 #ifdef DEBUG |
| 6217 v8::AssertNoGCScope::AssertNoGCScope(v8::Isolate* isolate) { | 6166 v8::AssertNoGCScope::AssertNoGCScope(v8::Isolate* isolate) { |
| 6218 disallow_heap_allocation_ = new i::DisallowHeapAllocation(); | 6167 disallow_heap_allocation_ = new i::DisallowHeapAllocation(); |
| (...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7523 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7472 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 7524 Address callback_address = | 7473 Address callback_address = |
| 7525 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7474 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 7526 VMState<EXTERNAL> state(isolate); | 7475 VMState<EXTERNAL> state(isolate); |
| 7527 ExternalCallbackScope call_scope(isolate, callback_address); | 7476 ExternalCallbackScope call_scope(isolate, callback_address); |
| 7528 callback(info); | 7477 callback(info); |
| 7529 } | 7478 } |
| 7530 | 7479 |
| 7531 | 7480 |
| 7532 } } // namespace v8::internal | 7481 } } // namespace v8::internal |
| OLD | NEW |