| 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 3080 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 4103   } | 4109   } | 
| 4104   return ToApiHandle<Primitive>(isolate->factory()->undefined_value()); | 4110   return ToApiHandle<Primitive>(isolate->factory()->undefined_value()); | 
| 4105 } | 4111 } | 
| 4106 | 4112 | 
| 4107 | 4113 | 
| 4108 ScriptOrigin Function::GetScriptOrigin() const { | 4114 ScriptOrigin Function::GetScriptOrigin() const { | 
| 4109   i::Handle<i::JSFunction> func = Utils::OpenHandle(this); | 4115   i::Handle<i::JSFunction> func = Utils::OpenHandle(this); | 
| 4110   if (func->shared()->script()->IsScript()) { | 4116   if (func->shared()->script()->IsScript()) { | 
| 4111     i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); | 4117     i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); | 
| 4112     i::Handle<i::Object> scriptName = GetScriptNameOrSourceURL(script); | 4118     i::Handle<i::Object> scriptName = GetScriptNameOrSourceURL(script); | 
| 4113     v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(func->GetIsolate()); |  | 
| 4114     v8::ScriptOrigin origin( | 4119     v8::ScriptOrigin origin( | 
| 4115       Utils::ToLocal(scriptName), | 4120       Utils::ToLocal(scriptName), | 
| 4116       v8::Integer::New(isolate, script->line_offset()->value()), | 4121       v8::Integer::New(script->line_offset()->value()), | 
| 4117       v8::Integer::New(isolate, script->column_offset()->value())); | 4122       v8::Integer::New(script->column_offset()->value())); | 
| 4118     return origin; | 4123     return origin; | 
| 4119   } | 4124   } | 
| 4120   return v8::ScriptOrigin(Handle<Value>()); | 4125   return v8::ScriptOrigin(Handle<Value>()); | 
| 4121 } | 4126 } | 
| 4122 | 4127 | 
| 4123 | 4128 | 
| 4124 const int Function::kLineOffsetNotFound = -1; | 4129 const int Function::kLineOffsetNotFound = -1; | 
| 4125 | 4130 | 
| 4126 | 4131 | 
| 4127 int Function::GetScriptLineNumber() const { | 4132 int Function::GetScriptLineNumber() const { | 
| (...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5338   i::Handle<i::JSObject> external = i_isolate->factory()->NewExternal(value); | 5343   i::Handle<i::JSObject> external = i_isolate->factory()->NewExternal(value); | 
| 5339   return Utils::ExternalToLocal(external); | 5344   return Utils::ExternalToLocal(external); | 
| 5340 } | 5345 } | 
| 5341 | 5346 | 
| 5342 | 5347 | 
| 5343 void* External::Value() const { | 5348 void* External::Value() const { | 
| 5344   return ExternalValue(*Utils::OpenHandle(this)); | 5349   return ExternalValue(*Utils::OpenHandle(this)); | 
| 5345 } | 5350 } | 
| 5346 | 5351 | 
| 5347 | 5352 | 
|  | 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 | 
| 5348 // anonymous namespace for string creation helper functions | 5363 // anonymous namespace for string creation helper functions | 
| 5349 namespace { | 5364 namespace { | 
| 5350 | 5365 | 
| 5351 inline int StringLength(const char* string) { | 5366 inline int StringLength(const char* string) { | 
| 5352   return i::StrLength(string); | 5367   return i::StrLength(string); | 
| 5353 } | 5368 } | 
| 5354 | 5369 | 
| 5355 | 5370 | 
| 5356 inline int StringLength(const uint8_t* string) { | 5371 inline int StringLength(const uint8_t* string) { | 
| 5357   return i::StrLength(reinterpret_cast<const char*>(string)); | 5372   return i::StrLength(reinterpret_cast<const char*>(string)); | 
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5400 inline Local<String> NewString(Isolate* v8_isolate, | 5415 inline Local<String> NewString(Isolate* v8_isolate, | 
| 5401                                const char* location, | 5416                                const char* location, | 
| 5402                                const char* env, | 5417                                const char* env, | 
| 5403                                const Char* data, | 5418                                const Char* data, | 
| 5404                                String::NewStringType type, | 5419                                String::NewStringType type, | 
| 5405                                int length) { | 5420                                int length) { | 
| 5406   i::Isolate* isolate = reinterpret_cast<internal::Isolate*>(v8_isolate); | 5421   i::Isolate* isolate = reinterpret_cast<internal::Isolate*>(v8_isolate); | 
| 5407   EnsureInitializedForIsolate(isolate, location); | 5422   EnsureInitializedForIsolate(isolate, location); | 
| 5408   LOG_API(isolate, env); | 5423   LOG_API(isolate, env); | 
| 5409   if (length == 0 && type != String::kUndetectableString) { | 5424   if (length == 0 && type != String::kUndetectableString) { | 
| 5410     return String::Empty(v8_isolate); | 5425     return String::Empty(); | 
| 5411   } | 5426   } | 
| 5412   ENTER_V8(isolate); | 5427   ENTER_V8(isolate); | 
| 5413   if (length == -1) length = StringLength(data); | 5428   if (length == -1) length = StringLength(data); | 
| 5414   i::Handle<i::String> result = NewString( | 5429   i::Handle<i::String> result = NewString( | 
| 5415       isolate->factory(), type, i::Vector<const Char>(data, length)); | 5430       isolate->factory(), type, i::Vector<const Char>(data, length)); | 
| 5416   if (type == String::kUndetectableString) { | 5431   if (type == String::kUndetectableString) { | 
| 5417     result->MarkAsUndetectable(); | 5432     result->MarkAsUndetectable(); | 
| 5418   } | 5433   } | 
| 5419   return Utils::ToLocal(result); | 5434   return Utils::ToLocal(result); | 
| 5420 } | 5435 } | 
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5631   i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 5646   i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 
| 5632   EnsureInitializedForIsolate(i_isolate, "v8::Object::New()"); | 5647   EnsureInitializedForIsolate(i_isolate, "v8::Object::New()"); | 
| 5633   LOG_API(i_isolate, "Object::New"); | 5648   LOG_API(i_isolate, "Object::New"); | 
| 5634   ENTER_V8(i_isolate); | 5649   ENTER_V8(i_isolate); | 
| 5635   i::Handle<i::JSObject> obj = | 5650   i::Handle<i::JSObject> obj = | 
| 5636       i_isolate->factory()->NewJSObject(i_isolate->object_function()); | 5651       i_isolate->factory()->NewJSObject(i_isolate->object_function()); | 
| 5637   return Utils::ToLocal(obj); | 5652   return Utils::ToLocal(obj); | 
| 5638 } | 5653 } | 
| 5639 | 5654 | 
| 5640 | 5655 | 
|  | 5656 Local<v8::Object> v8::Object::New() { | 
|  | 5657   return New(Isolate::GetCurrent()); | 
|  | 5658 } | 
|  | 5659 | 
|  | 5660 | 
| 5641 Local<v8::Value> v8::NumberObject::New(Isolate* isolate, double value) { | 5661 Local<v8::Value> v8::NumberObject::New(Isolate* isolate, double value) { | 
| 5642   i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 5662   i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 
| 5643   EnsureInitializedForIsolate(i_isolate, "v8::NumberObject::New()"); | 5663   EnsureInitializedForIsolate(i_isolate, "v8::NumberObject::New()"); | 
| 5644   LOG_API(i_isolate, "NumberObject::New"); | 5664   LOG_API(i_isolate, "NumberObject::New"); | 
| 5645   ENTER_V8(i_isolate); | 5665   ENTER_V8(i_isolate); | 
| 5646   i::Handle<i::Object> number = i_isolate->factory()->NewNumber(value); | 5666   i::Handle<i::Object> number = i_isolate->factory()->NewNumber(value); | 
| 5647   i::Handle<i::Object> obj = i_isolate->factory()->ToObject(number); | 5667   i::Handle<i::Object> obj = i_isolate->factory()->ToObject(number); | 
| 5648   return Utils::ToLocal(obj); | 5668   return Utils::ToLocal(obj); | 
| 5649 } | 5669 } | 
| 5650 | 5670 | 
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 6116     if (length == -1) length = i::StrLength(data); | 6136     if (length == -1) length = i::StrLength(data); | 
| 6117     i::Handle<i::String> name = i_isolate->factory()->NewStringFromUtf8( | 6137     i::Handle<i::String> name = i_isolate->factory()->NewStringFromUtf8( | 
| 6118         i::Vector<const char>(data, length)); | 6138         i::Vector<const char>(data, length)); | 
| 6119     symbol->set_name(*name); | 6139     symbol->set_name(*name); | 
| 6120   } | 6140   } | 
| 6121   Local<Symbol> result = Utils::ToLocal(symbol); | 6141   Local<Symbol> result = Utils::ToLocal(symbol); | 
| 6122   return v8::Handle<Private>(reinterpret_cast<Private*>(*result)); | 6142   return v8::Handle<Private>(reinterpret_cast<Private*>(*result)); | 
| 6123 } | 6143 } | 
| 6124 | 6144 | 
| 6125 | 6145 | 
|  | 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 | 
| 6126 Local<Number> v8::Number::New(Isolate* isolate, double value) { | 6153 Local<Number> v8::Number::New(Isolate* isolate, double value) { | 
| 6127   i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); | 6154   i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); | 
| 6128   ASSERT(internal_isolate->IsInitialized()); | 6155   ASSERT(internal_isolate->IsInitialized()); | 
| 6129   if (std::isnan(value)) { | 6156   if (std::isnan(value)) { | 
| 6130     // Introduce only canonical NaN value into the VM, to avoid signaling NaNs. | 6157     // Introduce only canonical NaN value into the VM, to avoid signaling NaNs. | 
| 6131     value = i::OS::nan_value(); | 6158     value = i::OS::nan_value(); | 
| 6132   } | 6159   } | 
| 6133   ENTER_V8(internal_isolate); | 6160   ENTER_V8(internal_isolate); | 
| 6134   i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value); | 6161   i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value); | 
| 6135   return Utils::NumberToLocal(result); | 6162   return Utils::NumberToLocal(result); | 
| 6136 } | 6163 } | 
| 6137 | 6164 | 
| 6138 | 6165 | 
|  | 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 | 
| 6139 Local<Integer> v8::Integer::New(Isolate* isolate, int32_t value) { | 6190 Local<Integer> v8::Integer::New(Isolate* isolate, int32_t value) { | 
| 6140   i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); | 6191   i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); | 
| 6141   ASSERT(internal_isolate->IsInitialized()); | 6192   ASSERT(internal_isolate->IsInitialized()); | 
| 6142   if (i::Smi::IsValid(value)) { | 6193   if (i::Smi::IsValid(value)) { | 
| 6143     return Utils::IntegerToLocal(i::Handle<i::Object>(i::Smi::FromInt(value), | 6194     return Utils::IntegerToLocal(i::Handle<i::Object>(i::Smi::FromInt(value), | 
| 6144                                                       internal_isolate)); | 6195                                                       internal_isolate)); | 
| 6145   } | 6196   } | 
| 6146   ENTER_V8(internal_isolate); | 6197   ENTER_V8(internal_isolate); | 
| 6147   i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value); | 6198   i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value); | 
| 6148   return Utils::IntegerToLocal(result); | 6199   return Utils::IntegerToLocal(result); | 
| 6149 } | 6200 } | 
| 6150 | 6201 | 
| 6151 | 6202 | 
| 6152 Local<Integer> v8::Integer::NewFromUnsigned(Isolate* isolate, uint32_t value) { | 6203 Local<Integer> v8::Integer::NewFromUnsigned(Isolate* isolate, uint32_t value) { | 
| 6153   i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); | 6204   i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); | 
| 6154   ASSERT(internal_isolate->IsInitialized()); | 6205   ASSERT(internal_isolate->IsInitialized()); | 
| 6155   bool fits_into_int32_t = (value & (1 << 31)) == 0; | 6206   bool fits_into_int32_t = (value & (1 << 31)) == 0; | 
| 6156   if (fits_into_int32_t) { | 6207   if (fits_into_int32_t) { | 
| 6157     return Integer::New(isolate, static_cast<int32_t>(value)); | 6208     return Integer::New(static_cast<int32_t>(value), isolate); | 
| 6158   } | 6209   } | 
| 6159   ENTER_V8(internal_isolate); | 6210   ENTER_V8(internal_isolate); | 
| 6160   i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value); | 6211   i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value); | 
| 6161   return Utils::IntegerToLocal(result); | 6212   return Utils::IntegerToLocal(result); | 
| 6162 } | 6213 } | 
| 6163 | 6214 | 
| 6164 | 6215 | 
| 6165 #ifdef DEBUG | 6216 #ifdef DEBUG | 
| 6166 v8::AssertNoGCScope::AssertNoGCScope(v8::Isolate* isolate) { | 6217 v8::AssertNoGCScope::AssertNoGCScope(v8::Isolate* isolate) { | 
| 6167   disallow_heap_allocation_ = new i::DisallowHeapAllocation(); | 6218   disallow_heap_allocation_ = new i::DisallowHeapAllocation(); | 
| (...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 7472   Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7523   Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 
| 7473   Address callback_address = | 7524   Address callback_address = | 
| 7474       reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7525       reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 
| 7475   VMState<EXTERNAL> state(isolate); | 7526   VMState<EXTERNAL> state(isolate); | 
| 7476   ExternalCallbackScope call_scope(isolate, callback_address); | 7527   ExternalCallbackScope call_scope(isolate, callback_address); | 
| 7477   callback(info); | 7528   callback(info); | 
| 7478 } | 7529 } | 
| 7479 | 7530 | 
| 7480 | 7531 | 
| 7481 } }  // namespace v8::internal | 7532 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|