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 4228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4239 } | 4239 } |
4240 | 4240 |
4241 | 4241 |
4242 Local<v8::Array> v8::Array::New(int length) { | 4242 Local<v8::Array> v8::Array::New(int length) { |
4243 i::Isolate* isolate = i::Isolate::Current(); | 4243 i::Isolate* isolate = i::Isolate::Current(); |
4244 EnsureInitializedForIsolate(isolate, "v8::Array::New()"); | 4244 EnsureInitializedForIsolate(isolate, "v8::Array::New()"); |
4245 LOG_API(isolate, "Array::New"); | 4245 LOG_API(isolate, "Array::New"); |
4246 ENTER_V8(isolate); | 4246 ENTER_V8(isolate); |
4247 int real_length = length > 0 ? length : 0; | 4247 int real_length = length > 0 ? length : 0; |
4248 i::Handle<i::JSArray> obj = isolate->factory()->NewJSArray(real_length); | 4248 i::Handle<i::JSArray> obj = isolate->factory()->NewJSArray(real_length); |
4249 obj->set_length(*isolate->factory()->NewNumberFromInt(real_length)); | 4249 i::Handle<i::Object> length_obj = |
| 4250 isolate->factory()->NewNumberFromInt(real_length); |
| 4251 obj->set_length(*length_obj); |
4250 return Utils::ToLocal(obj); | 4252 return Utils::ToLocal(obj); |
4251 } | 4253 } |
4252 | 4254 |
4253 | 4255 |
4254 uint32_t v8::Array::Length() const { | 4256 uint32_t v8::Array::Length() const { |
4255 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 4257 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
4256 if (IsDeadCheck(isolate, "v8::Array::Length()")) return 0; | 4258 if (IsDeadCheck(isolate, "v8::Array::Length()")) return 0; |
4257 i::Handle<i::JSArray> obj = Utils::OpenHandle(this); | 4259 i::Handle<i::JSArray> obj = Utils::OpenHandle(this); |
4258 i::Object* length = obj->length(); | 4260 i::Object* length = obj->length(); |
4259 if (length->IsSmi()) { | 4261 if (length->IsSmi()) { |
(...skipping 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5638 | 5640 |
5639 | 5641 |
5640 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 5642 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
5641 HandleScopeImplementer* scope_implementer = | 5643 HandleScopeImplementer* scope_implementer = |
5642 reinterpret_cast<HandleScopeImplementer*>(storage); | 5644 reinterpret_cast<HandleScopeImplementer*>(storage); |
5643 scope_implementer->IterateThis(v); | 5645 scope_implementer->IterateThis(v); |
5644 return storage + ArchiveSpacePerThread(); | 5646 return storage + ArchiveSpacePerThread(); |
5645 } | 5647 } |
5646 | 5648 |
5647 } } // namespace v8::internal | 5649 } } // namespace v8::internal |
OLD | NEW |