Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(449)

Side by Side Diff: src/api.cc

Issue 6711027: [Isolates] Merge 7201:7258 from bleeding_edge to isolates. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 4177 matching lines...) Expand 10 before | Expand all | Expand 10 after
4188 i::Handle<i::JSRegExp> obj = Utils::OpenHandle(this); 4188 i::Handle<i::JSRegExp> obj = Utils::OpenHandle(this);
4189 return static_cast<RegExp::Flags>(obj->GetFlags().value()); 4189 return static_cast<RegExp::Flags>(obj->GetFlags().value());
4190 } 4190 }
4191 4191
4192 4192
4193 Local<v8::Array> v8::Array::New(int length) { 4193 Local<v8::Array> v8::Array::New(int length) {
4194 i::Isolate* isolate = i::Isolate::Current(); 4194 i::Isolate* isolate = i::Isolate::Current();
4195 EnsureInitializedForIsolate(isolate, "v8::Array::New()"); 4195 EnsureInitializedForIsolate(isolate, "v8::Array::New()");
4196 LOG_API(isolate, "Array::New"); 4196 LOG_API(isolate, "Array::New");
4197 ENTER_V8; 4197 ENTER_V8;
4198 i::Handle<i::JSArray> obj = FACTORY->NewJSArray(length); 4198 int real_length = length > 0 ? length : 0;
4199 i::Handle<i::JSArray> obj = isolate->factory()->NewJSArray(real_length);
4200 obj->set_length(*isolate->factory()->NewNumberFromInt(real_length));
4199 return Utils::ToLocal(obj); 4201 return Utils::ToLocal(obj);
4200 } 4202 }
4201 4203
4202 4204
4203 uint32_t v8::Array::Length() const { 4205 uint32_t v8::Array::Length() const {
4204 i::Isolate* isolate = i::Isolate::Current(); 4206 i::Isolate* isolate = i::Isolate::Current();
4205 if (IsDeadCheck(isolate, "v8::Array::Length()")) return 0; 4207 if (IsDeadCheck(isolate, "v8::Array::Length()")) return 0;
4206 i::Handle<i::JSArray> obj = Utils::OpenHandle(this); 4208 i::Handle<i::JSArray> obj = Utils::OpenHandle(this);
4207 i::Object* length = obj->length(); 4209 i::Object* length = obj->length();
4208 if (length->IsSmi()) { 4210 if (length->IsSmi()) {
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
4371 } 4373 }
4372 isolate->SetFailedAccessCheckCallback(callback); 4374 isolate->SetFailedAccessCheckCallback(callback);
4373 } 4375 }
4374 4376
4375 void V8::AddObjectGroup(Persistent<Value>* objects, 4377 void V8::AddObjectGroup(Persistent<Value>* objects,
4376 size_t length, 4378 size_t length,
4377 RetainedObjectInfo* info) { 4379 RetainedObjectInfo* info) {
4378 i::Isolate* isolate = i::Isolate::Current(); 4380 i::Isolate* isolate = i::Isolate::Current();
4379 if (IsDeadCheck(isolate, "v8::V8::AddObjectGroup()")) return; 4381 if (IsDeadCheck(isolate, "v8::V8::AddObjectGroup()")) return;
4380 STATIC_ASSERT(sizeof(Persistent<Value>) == sizeof(i::Object**)); 4382 STATIC_ASSERT(sizeof(Persistent<Value>) == sizeof(i::Object**));
4381 isolate->global_handles()->AddGroup( 4383 isolate->global_handles()->AddObjectGroup(
4382 reinterpret_cast<i::Object***>(objects), length, info); 4384 reinterpret_cast<i::Object***>(objects), length, info);
4383 } 4385 }
4384 4386
4385 4387
4388 void V8::AddImplicitReferences(Persistent<Object> parent,
4389 Persistent<Value>* children,
4390 size_t length) {
4391 i::Isolate* isolate = i::Isolate::Current();
4392 if (IsDeadCheck(isolate, "v8::V8::AddImplicitReferences()")) return;
4393 STATIC_ASSERT(sizeof(Persistent<Value>) == sizeof(i::Object**));
4394 isolate->global_handles()->AddImplicitReferences(
4395 *Utils::OpenHandle(*parent),
4396 reinterpret_cast<i::Object***>(children), length);
4397 }
4398
4399
4386 int V8::AdjustAmountOfExternalAllocatedMemory(int change_in_bytes) { 4400 int V8::AdjustAmountOfExternalAllocatedMemory(int change_in_bytes) {
4387 i::Isolate* isolate = i::Isolate::Current(); 4401 i::Isolate* isolate = i::Isolate::Current();
4388 if (IsDeadCheck(isolate, "v8::V8::AdjustAmountOfExternalAllocatedMemory()")) { 4402 if (IsDeadCheck(isolate, "v8::V8::AdjustAmountOfExternalAllocatedMemory()")) {
4389 return 0; 4403 return 0;
4390 } 4404 }
4391 return isolate->heap()->AdjustAmountOfExternalAllocatedMemory( 4405 return isolate->heap()->AdjustAmountOfExternalAllocatedMemory(
4392 change_in_bytes); 4406 change_in_bytes);
4393 } 4407 }
4394 4408
4395 4409
(...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after
5594 5608
5595 5609
5596 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 5610 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
5597 HandleScopeImplementer* thread_local = 5611 HandleScopeImplementer* thread_local =
5598 reinterpret_cast<HandleScopeImplementer*>(storage); 5612 reinterpret_cast<HandleScopeImplementer*>(storage);
5599 thread_local->IterateThis(v); 5613 thread_local->IterateThis(v);
5600 return storage + ArchiveSpacePerThread(); 5614 return storage + ArchiveSpacePerThread();
5601 } 5615 }
5602 5616
5603 } } // namespace v8::internal 5617 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/arm/code-stubs-arm.cc » ('j') | src/global-handles.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698