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