| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 3942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3953 if (IsDeadCheck("v8::RegExp::GetFlags()")) return v8::RegExp::kNone; | 3953 if (IsDeadCheck("v8::RegExp::GetFlags()")) return v8::RegExp::kNone; |
| 3954 i::Handle<i::JSRegExp> obj = Utils::OpenHandle(this); | 3954 i::Handle<i::JSRegExp> obj = Utils::OpenHandle(this); |
| 3955 return static_cast<RegExp::Flags>(obj->GetFlags().value()); | 3955 return static_cast<RegExp::Flags>(obj->GetFlags().value()); |
| 3956 } | 3956 } |
| 3957 | 3957 |
| 3958 | 3958 |
| 3959 Local<v8::Array> v8::Array::New(int length) { | 3959 Local<v8::Array> v8::Array::New(int length) { |
| 3960 EnsureInitialized("v8::Array::New()"); | 3960 EnsureInitialized("v8::Array::New()"); |
| 3961 LOG_API("Array::New"); | 3961 LOG_API("Array::New"); |
| 3962 ENTER_V8; | 3962 ENTER_V8; |
| 3963 i::Handle<i::JSArray> obj = i::Factory::NewJSArray(length); | 3963 int real_length = length > 0 ? length : 0; |
| 3964 i::Handle<i::JSArray> obj = i::Factory::NewJSArray(real_length); |
| 3965 obj->set_length(*i::Factory::NewNumberFromInt(real_length)); |
| 3964 return Utils::ToLocal(obj); | 3966 return Utils::ToLocal(obj); |
| 3965 } | 3967 } |
| 3966 | 3968 |
| 3967 | 3969 |
| 3968 uint32_t v8::Array::Length() const { | 3970 uint32_t v8::Array::Length() const { |
| 3969 if (IsDeadCheck("v8::Array::Length()")) return 0; | 3971 if (IsDeadCheck("v8::Array::Length()")) return 0; |
| 3970 i::Handle<i::JSArray> obj = Utils::OpenHandle(this); | 3972 i::Handle<i::JSArray> obj = Utils::OpenHandle(this); |
| 3971 i::Object* length = obj->length(); | 3973 i::Object* length = obj->length(); |
| 3972 if (length->IsSmi()) { | 3974 if (length->IsSmi()) { |
| 3973 return i::Smi::cast(length)->value(); | 3975 return i::Smi::cast(length)->value(); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4119 if (IsDeadCheck("v8::V8::SetFailedAccessCheckCallbackFunction()")) return; | 4121 if (IsDeadCheck("v8::V8::SetFailedAccessCheckCallbackFunction()")) return; |
| 4120 i::Top::SetFailedAccessCheckCallback(callback); | 4122 i::Top::SetFailedAccessCheckCallback(callback); |
| 4121 } | 4123 } |
| 4122 | 4124 |
| 4123 | 4125 |
| 4124 void V8::AddObjectGroup(Persistent<Value>* objects, | 4126 void V8::AddObjectGroup(Persistent<Value>* objects, |
| 4125 size_t length, | 4127 size_t length, |
| 4126 RetainedObjectInfo* info) { | 4128 RetainedObjectInfo* info) { |
| 4127 if (IsDeadCheck("v8::V8::AddObjectGroup()")) return; | 4129 if (IsDeadCheck("v8::V8::AddObjectGroup()")) return; |
| 4128 STATIC_ASSERT(sizeof(Persistent<Value>) == sizeof(i::Object**)); | 4130 STATIC_ASSERT(sizeof(Persistent<Value>) == sizeof(i::Object**)); |
| 4129 i::GlobalHandles::AddGroup( | 4131 i::GlobalHandles::AddObjectGroup( |
| 4130 reinterpret_cast<i::Object***>(objects), length, info); | 4132 reinterpret_cast<i::Object***>(objects), length, info); |
| 4131 } | 4133 } |
| 4132 | 4134 |
| 4133 | 4135 |
| 4136 void V8::AddImplicitReferences(Persistent<Object> parent, |
| 4137 Persistent<Value>* children, |
| 4138 size_t length) { |
| 4139 if (IsDeadCheck("v8::V8::AddImplicitReferences()")) return; |
| 4140 STATIC_ASSERT(sizeof(Persistent<Value>) == sizeof(i::Object**)); |
| 4141 i::GlobalHandles::AddImplicitReferences( |
| 4142 *Utils::OpenHandle(*parent), |
| 4143 reinterpret_cast<i::Object***>(children), length); |
| 4144 } |
| 4145 |
| 4146 |
| 4134 int V8::AdjustAmountOfExternalAllocatedMemory(int change_in_bytes) { | 4147 int V8::AdjustAmountOfExternalAllocatedMemory(int change_in_bytes) { |
| 4135 if (IsDeadCheck("v8::V8::AdjustAmountOfExternalAllocatedMemory()")) return 0; | 4148 if (IsDeadCheck("v8::V8::AdjustAmountOfExternalAllocatedMemory()")) return 0; |
| 4136 return i::Heap::AdjustAmountOfExternalAllocatedMemory(change_in_bytes); | 4149 return i::Heap::AdjustAmountOfExternalAllocatedMemory(change_in_bytes); |
| 4137 } | 4150 } |
| 4138 | 4151 |
| 4139 | 4152 |
| 4140 void V8::SetGlobalGCPrologueCallback(GCCallback callback) { | 4153 void V8::SetGlobalGCPrologueCallback(GCCallback callback) { |
| 4141 if (IsDeadCheck("v8::V8::SetGlobalGCPrologueCallback()")) return; | 4154 if (IsDeadCheck("v8::V8::SetGlobalGCPrologueCallback()")) return; |
| 4142 i::Heap::SetGlobalGCPrologueCallback(callback); | 4155 i::Heap::SetGlobalGCPrologueCallback(callback); |
| 4143 } | 4156 } |
| (...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5224 | 5237 |
| 5225 | 5238 |
| 5226 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 5239 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
| 5227 HandleScopeImplementer* thread_local = | 5240 HandleScopeImplementer* thread_local = |
| 5228 reinterpret_cast<HandleScopeImplementer*>(storage); | 5241 reinterpret_cast<HandleScopeImplementer*>(storage); |
| 5229 thread_local->IterateThis(v); | 5242 thread_local->IterateThis(v); |
| 5230 return storage + ArchiveSpacePerThread(); | 5243 return storage + ArchiveSpacePerThread(); |
| 5231 } | 5244 } |
| 5232 | 5245 |
| 5233 } } // namespace v8::internal | 5246 } } // namespace v8::internal |
| OLD | NEW |