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