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

Side by Side Diff: src/api.cc

Issue 110573004: Merge bleeding_edge 17696:18016. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years 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 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 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 return v8::Handle<Boolean>(); 556 return v8::Handle<Boolean>();
557 } 557 }
558 return ToApiHandle<Boolean>(isolate->factory()->false_value()); 558 return ToApiHandle<Boolean>(isolate->factory()->false_value());
559 } 559 }
560 560
561 561
562 ResourceConstraints::ResourceConstraints() 562 ResourceConstraints::ResourceConstraints()
563 : max_young_space_size_(0), 563 : max_young_space_size_(0),
564 max_old_space_size_(0), 564 max_old_space_size_(0),
565 max_executable_size_(0), 565 max_executable_size_(0),
566 stack_limit_(NULL) { } 566 stack_limit_(NULL),
567 max_available_threads_(0) { }
567 568
569 void ResourceConstraints::ConfigureDefaults(uint64_t physical_memory,
570 uint32_t number_of_processors) {
571 const int lump_of_memory = (i::kPointerSize / 4) * i::MB;
572 #if V8_OS_ANDROID
573 // Android has higher physical memory requirements before raising the maximum
574 // heap size limits since it has no swap space.
575 const uint64_t low_limit = 512ul * i::MB;
576 const uint64_t medium_limit = 1ul * i::GB;
577 const uint64_t high_limit = 2ul * i::GB;
578 #else
579 const uint64_t low_limit = 512ul * i::MB;
580 const uint64_t medium_limit = 768ul * i::MB;
581 const uint64_t high_limit = 1ul * i::GB;
582 #endif
568 583
569 bool SetResourceConstraints(ResourceConstraints* constraints) { 584 // The young_space_size should be a power of 2 and old_generation_size should
570 i::Isolate* isolate = EnterIsolateIfNeeded(); 585 // be a multiple of Page::kPageSize.
571 return SetResourceConstraints(reinterpret_cast<Isolate*>(isolate), 586 if (physical_memory <= low_limit) {
572 constraints); 587 set_max_young_space_size(2 * lump_of_memory);
588 set_max_old_space_size(128 * lump_of_memory);
589 set_max_executable_size(96 * lump_of_memory);
590 } else if (physical_memory <= medium_limit) {
591 set_max_young_space_size(8 * lump_of_memory);
592 set_max_old_space_size(256 * lump_of_memory);
593 set_max_executable_size(192 * lump_of_memory);
594 } else if (physical_memory <= high_limit) {
595 set_max_young_space_size(16 * lump_of_memory);
596 set_max_old_space_size(512 * lump_of_memory);
597 set_max_executable_size(256 * lump_of_memory);
598 } else {
599 set_max_young_space_size(16 * lump_of_memory);
600 set_max_old_space_size(700 * lump_of_memory);
601 set_max_executable_size(256 * lump_of_memory);
602 }
603
604 set_max_available_threads(i::Max(i::Min(number_of_processors, 4u), 1u));
573 } 605 }
574 606
575 607
608 void ResourceConstraints::ConfigureDefaults(uint64_t physical_memory) {
609 ConfigureDefaults(physical_memory, i::CPU::NumberOfProcessorsOnline());
610 }
611
612
576 bool SetResourceConstraints(Isolate* v8_isolate, 613 bool SetResourceConstraints(Isolate* v8_isolate,
577 ResourceConstraints* constraints) { 614 ResourceConstraints* constraints) {
578 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); 615 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
579 int young_space_size = constraints->max_young_space_size(); 616 int young_space_size = constraints->max_young_space_size();
580 int old_gen_size = constraints->max_old_space_size(); 617 int old_gen_size = constraints->max_old_space_size();
581 int max_executable_size = constraints->max_executable_size(); 618 int max_executable_size = constraints->max_executable_size();
582 if (young_space_size != 0 || old_gen_size != 0 || max_executable_size != 0) { 619 if (young_space_size != 0 || old_gen_size != 0 || max_executable_size != 0) {
583 // After initialization it's too late to change Heap constraints. 620 // After initialization it's too late to change Heap constraints.
584 ASSERT(!isolate->IsInitialized()); 621 ASSERT(!isolate->IsInitialized());
585 bool result = isolate->heap()->ConfigureHeap(young_space_size / 2, 622 bool result = isolate->heap()->ConfigureHeap(young_space_size / 2,
586 old_gen_size, 623 old_gen_size,
587 max_executable_size); 624 max_executable_size);
588 if (!result) return false; 625 if (!result) return false;
589 } 626 }
590 if (constraints->stack_limit() != NULL) { 627 if (constraints->stack_limit() != NULL) {
591 uintptr_t limit = reinterpret_cast<uintptr_t>(constraints->stack_limit()); 628 uintptr_t limit = reinterpret_cast<uintptr_t>(constraints->stack_limit());
592 isolate->stack_guard()->SetStackLimit(limit); 629 isolate->stack_guard()->SetStackLimit(limit);
593 } 630 }
631
632 isolate->set_max_available_threads(constraints->max_available_threads());
594 return true; 633 return true;
595 } 634 }
596 635
597 636
598 i::Object** V8::GlobalizeReference(i::Isolate* isolate, i::Object** obj) { 637 i::Object** V8::GlobalizeReference(i::Isolate* isolate, i::Object** obj) {
599 LOG_API(isolate, "Persistent::New"); 638 LOG_API(isolate, "Persistent::New");
600 i::Handle<i::Object> result = isolate->global_handles()->Create(*obj); 639 i::Handle<i::Object> result = isolate->global_handles()->Create(*obj);
601 #ifdef DEBUG 640 #ifdef DEBUG
602 (*obj)->Verify(); 641 (*obj)->Verify();
603 #endif // DEBUG 642 #endif // DEBUG
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 1260
1222 1261
1223 int TypeSwitch::match(v8::Handle<Value> value) { 1262 int TypeSwitch::match(v8::Handle<Value> value) {
1224 i::Isolate* isolate = i::Isolate::Current(); 1263 i::Isolate* isolate = i::Isolate::Current();
1225 LOG_API(isolate, "TypeSwitch::match"); 1264 LOG_API(isolate, "TypeSwitch::match");
1226 USE(isolate); 1265 USE(isolate);
1227 i::Handle<i::Object> obj = Utils::OpenHandle(*value); 1266 i::Handle<i::Object> obj = Utils::OpenHandle(*value);
1228 i::Handle<i::TypeSwitchInfo> info = Utils::OpenHandle(this); 1267 i::Handle<i::TypeSwitchInfo> info = Utils::OpenHandle(this);
1229 i::FixedArray* types = i::FixedArray::cast(info->types()); 1268 i::FixedArray* types = i::FixedArray::cast(info->types());
1230 for (int i = 0; i < types->length(); i++) { 1269 for (int i = 0; i < types->length(); i++) {
1231 if (obj->IsInstanceOf(i::FunctionTemplateInfo::cast(types->get(i)))) 1270 if (i::FunctionTemplateInfo::cast(types->get(i))->IsTemplateFor(*obj))
1232 return i + 1; 1271 return i + 1;
1233 } 1272 }
1234 return 0; 1273 return 0;
1235 } 1274 }
1236 1275
1237 1276
1238 #define SET_FIELD_WRAPPED(obj, setter, cdata) do { \ 1277 #define SET_FIELD_WRAPPED(obj, setter, cdata) do { \
1239 i::Handle<i::Object> foreign = FromCData(obj->GetIsolate(), cdata); \ 1278 i::Handle<i::Object> foreign = FromCData(obj->GetIsolate(), cdata); \
1240 (obj)->setter(*foreign); \ 1279 (obj)->setter(*foreign); \
1241 } while (false) 1280 } while (false)
(...skipping 2067 matching lines...) Expand 10 before | Expand all | Expand 10 after
3309 3348
3310 Local<Object> v8::Object::FindInstanceInPrototypeChain( 3349 Local<Object> v8::Object::FindInstanceInPrototypeChain(
3311 v8::Handle<FunctionTemplate> tmpl) { 3350 v8::Handle<FunctionTemplate> tmpl) {
3312 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3351 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3313 ON_BAILOUT(isolate, 3352 ON_BAILOUT(isolate,
3314 "v8::Object::FindInstanceInPrototypeChain()", 3353 "v8::Object::FindInstanceInPrototypeChain()",
3315 return Local<v8::Object>()); 3354 return Local<v8::Object>());
3316 ENTER_V8(isolate); 3355 ENTER_V8(isolate);
3317 i::JSObject* object = *Utils::OpenHandle(this); 3356 i::JSObject* object = *Utils::OpenHandle(this);
3318 i::FunctionTemplateInfo* tmpl_info = *Utils::OpenHandle(*tmpl); 3357 i::FunctionTemplateInfo* tmpl_info = *Utils::OpenHandle(*tmpl);
3319 while (!object->IsInstanceOf(tmpl_info)) { 3358 while (!tmpl_info->IsTemplateFor(object)) {
3320 i::Object* prototype = object->GetPrototype(); 3359 i::Object* prototype = object->GetPrototype();
3321 if (!prototype->IsJSObject()) return Local<Object>(); 3360 if (!prototype->IsJSObject()) return Local<Object>();
3322 object = i::JSObject::cast(prototype); 3361 object = i::JSObject::cast(prototype);
3323 } 3362 }
3324 return Utils::ToLocal(i::Handle<i::JSObject>(object)); 3363 return Utils::ToLocal(i::Handle<i::JSObject>(object));
3325 } 3364 }
3326 3365
3327 3366
3328 Local<Array> v8::Object::GetPropertyNames() { 3367 Local<Array> v8::Object::GetPropertyNames() {
3329 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3368 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
3361 // to never change the result of the basic enumeration function so 3400 // to never change the result of the basic enumeration function so
3362 // we clone the result. 3401 // we clone the result.
3363 i::Handle<i::FixedArray> elms = isolate->factory()->CopyFixedArray(value); 3402 i::Handle<i::FixedArray> elms = isolate->factory()->CopyFixedArray(value);
3364 i::Handle<i::JSArray> result = 3403 i::Handle<i::JSArray> result =
3365 isolate->factory()->NewJSArrayWithElements(elms); 3404 isolate->factory()->NewJSArrayWithElements(elms);
3366 return Utils::ToLocal(scope.CloseAndEscape(result)); 3405 return Utils::ToLocal(scope.CloseAndEscape(result));
3367 } 3406 }
3368 3407
3369 3408
3370 Local<String> v8::Object::ObjectProtoToString() { 3409 Local<String> v8::Object::ObjectProtoToString() {
3371 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3410 i::Isolate* i_isolate = Utils::OpenHandle(this)->GetIsolate();
3372 ON_BAILOUT(isolate, "v8::Object::ObjectProtoToString()", 3411 Isolate* isolate = reinterpret_cast<Isolate*>(i_isolate);
3412 ON_BAILOUT(i_isolate, "v8::Object::ObjectProtoToString()",
3373 return Local<v8::String>()); 3413 return Local<v8::String>());
3374 ENTER_V8(isolate); 3414 ENTER_V8(i_isolate);
3375 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3415 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
3376 3416
3377 i::Handle<i::Object> name(self->class_name(), isolate); 3417 i::Handle<i::Object> name(self->class_name(), i_isolate);
3378 3418
3379 // Native implementation of Object.prototype.toString (v8natives.js): 3419 // Native implementation of Object.prototype.toString (v8natives.js):
3380 // var c = %_ClassOf(this); 3420 // var c = %_ClassOf(this);
3381 // if (c === 'Arguments') c = 'Object'; 3421 // if (c === 'Arguments') c = 'Object';
3382 // return "[object " + c + "]"; 3422 // return "[object " + c + "]";
3383 3423
3384 if (!name->IsString()) { 3424 if (!name->IsString()) {
3385 return v8::String::New("[object ]"); 3425 return v8::String::NewFromUtf8(isolate, "[object ]");
3386
3387 } else { 3426 } else {
3388 i::Handle<i::String> class_name = i::Handle<i::String>::cast(name); 3427 i::Handle<i::String> class_name = i::Handle<i::String>::cast(name);
3389 if (class_name->IsOneByteEqualTo(STATIC_ASCII_VECTOR("Arguments"))) { 3428 if (class_name->IsOneByteEqualTo(STATIC_ASCII_VECTOR("Arguments"))) {
3390 return v8::String::New("[object Object]"); 3429 return v8::String::NewFromUtf8(isolate, "[object Object]");
3391
3392 } else { 3430 } else {
3393 const char* prefix = "[object "; 3431 const char* prefix = "[object ";
3394 Local<String> str = Utils::ToLocal(class_name); 3432 Local<String> str = Utils::ToLocal(class_name);
3395 const char* postfix = "]"; 3433 const char* postfix = "]";
3396 3434
3397 int prefix_len = i::StrLength(prefix); 3435 int prefix_len = i::StrLength(prefix);
3398 int str_len = str->Utf8Length(); 3436 int str_len = str->Utf8Length();
3399 int postfix_len = i::StrLength(postfix); 3437 int postfix_len = i::StrLength(postfix);
3400 3438
3401 int buf_len = prefix_len + str_len + postfix_len; 3439 int buf_len = prefix_len + str_len + postfix_len;
3402 i::ScopedVector<char> buf(buf_len); 3440 i::ScopedVector<char> buf(buf_len);
3403 3441
3404 // Write prefix. 3442 // Write prefix.
3405 char* ptr = buf.start(); 3443 char* ptr = buf.start();
3406 i::OS::MemCopy(ptr, prefix, prefix_len * v8::internal::kCharSize); 3444 i::OS::MemCopy(ptr, prefix, prefix_len * v8::internal::kCharSize);
3407 ptr += prefix_len; 3445 ptr += prefix_len;
3408 3446
3409 // Write real content. 3447 // Write real content.
3410 str->WriteUtf8(ptr, str_len); 3448 str->WriteUtf8(ptr, str_len);
3411 ptr += str_len; 3449 ptr += str_len;
3412 3450
3413 // Write postfix. 3451 // Write postfix.
3414 i::OS::MemCopy(ptr, postfix, postfix_len * v8::internal::kCharSize); 3452 i::OS::MemCopy(ptr, postfix, postfix_len * v8::internal::kCharSize);
3415 3453
3416 // Copy the buffer into a heap-allocated string and return it. 3454 // Copy the buffer into a heap-allocated string and return it.
3417 Local<String> result = v8::String::New(buf.start(), buf_len); 3455 Local<String> result = v8::String::NewFromUtf8(
3456 isolate, buf.start(), String::kNormalString, buf_len);
3418 return result; 3457 return result;
3419 } 3458 }
3420 } 3459 }
3421 } 3460 }
3422 3461
3423 3462
3424 Local<Value> v8::Object::GetConstructor() { 3463 Local<Value> v8::Object::GetConstructor() {
3425 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3464 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3426 ON_BAILOUT(isolate, "v8::Object::GetConstructor()", 3465 ON_BAILOUT(isolate, "v8::Object::GetConstructor()",
3427 return Local<v8::Function>()); 3466 return Local<v8::Function>());
(...skipping 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after
5005 // Obscure semantics for undefined, but somehow checked in our unit tests... 5044 // Obscure semantics for undefined, but somehow checked in our unit tests...
5006 if (obj->IsUndefined()) return NULL; 5045 if (obj->IsUndefined()) return NULL;
5007 i::Object* foreign = i::JSObject::cast(obj)->GetInternalField(0); 5046 i::Object* foreign = i::JSObject::cast(obj)->GetInternalField(0);
5008 return i::Foreign::cast(foreign)->foreign_address(); 5047 return i::Foreign::cast(foreign)->foreign_address();
5009 } 5048 }
5010 5049
5011 5050
5012 // --- E n v i r o n m e n t --- 5051 // --- E n v i r o n m e n t ---
5013 5052
5014 5053
5054 void v8::V8::InitializePlatform(Platform* platform) {
5055 #ifdef V8_USE_DEFAULT_PLATFORM
5056 FATAL("Can't override v8::Platform when using default implementation");
5057 #else
5058 i::V8::InitializePlatform(platform);
5059 #endif
5060 }
5061
5062
5063 void v8::V8::ShutdownPlatform() {
5064 #ifdef V8_USE_DEFAULT_PLATFORM
5065 FATAL("Can't override v8::Platform when using default implementation");
5066 #else
5067 i::V8::ShutdownPlatform();
5068 #endif
5069 }
5070
5071
5015 bool v8::V8::Initialize() { 5072 bool v8::V8::Initialize() {
5016 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); 5073 i::Isolate* isolate = i::Isolate::UncheckedCurrent();
5017 if (isolate != NULL && isolate->IsInitialized()) { 5074 if (isolate != NULL && isolate->IsInitialized()) {
5018 return true; 5075 return true;
5019 } 5076 }
5020 return InitializeHelper(isolate); 5077 return InitializeHelper(isolate);
5021 } 5078 }
5022 5079
5023 5080
5024 void v8::V8::SetEntropySource(EntropySource entropy_source) { 5081 void v8::V8::SetEntropySource(EntropySource entropy_source) {
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
5390 &has_pending_exception); 5447 &has_pending_exception);
5391 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Function>()); 5448 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Function>());
5392 return Utils::ToLocal(i::Handle<i::JSFunction>::cast(obj)); 5449 return Utils::ToLocal(i::Handle<i::JSFunction>::cast(obj));
5393 } 5450 }
5394 5451
5395 5452
5396 bool FunctionTemplate::HasInstance(v8::Handle<v8::Value> value) { 5453 bool FunctionTemplate::HasInstance(v8::Handle<v8::Value> value) {
5397 ON_BAILOUT(i::Isolate::Current(), "v8::FunctionTemplate::HasInstanceOf()", 5454 ON_BAILOUT(i::Isolate::Current(), "v8::FunctionTemplate::HasInstanceOf()",
5398 return false); 5455 return false);
5399 i::Object* obj = *Utils::OpenHandle(*value); 5456 i::Object* obj = *Utils::OpenHandle(*value);
5400 return obj->IsInstanceOf(*Utils::OpenHandle(this)); 5457 return Utils::OpenHandle(this)->IsTemplateFor(obj);
5401 } 5458 }
5402 5459
5403 5460
5404 Local<External> v8::External::New(Isolate* isolate, void* value) { 5461 Local<External> v8::External::New(Isolate* isolate, void* value) {
5405 STATIC_ASSERT(sizeof(value) == sizeof(i::Address)); 5462 STATIC_ASSERT(sizeof(value) == sizeof(i::Address));
5406 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); 5463 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
5407 EnsureInitializedForIsolate(i_isolate, "v8::External::New()"); 5464 EnsureInitializedForIsolate(i_isolate, "v8::External::New()");
5408 LOG_API(i_isolate, "External::New"); 5465 LOG_API(i_isolate, "External::New");
5409 ENTER_V8(i_isolate); 5466 ENTER_V8(i_isolate);
5410 i::Handle<i::JSObject> external = i_isolate->factory()->NewExternal(value); 5467 i::Handle<i::JSObject> external = i_isolate->factory()->NewExternal(value);
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
6095 i::ElementsKind elements_kind> 6152 i::ElementsKind elements_kind>
6096 i::Handle<i::JSTypedArray> NewTypedArray( 6153 i::Handle<i::JSTypedArray> NewTypedArray(
6097 i::Isolate* isolate, 6154 i::Isolate* isolate,
6098 Handle<ArrayBuffer> array_buffer, size_t byte_offset, size_t length) { 6155 Handle<ArrayBuffer> array_buffer, size_t byte_offset, size_t length) {
6099 i::Handle<i::JSTypedArray> obj = 6156 i::Handle<i::JSTypedArray> obj =
6100 isolate->factory()->NewJSTypedArray(array_type); 6157 isolate->factory()->NewJSTypedArray(array_type);
6101 i::Handle<i::JSArrayBuffer> buffer = Utils::OpenHandle(*array_buffer); 6158 i::Handle<i::JSArrayBuffer> buffer = Utils::OpenHandle(*array_buffer);
6102 6159
6103 ASSERT(byte_offset % sizeof(ElementType) == 0); 6160 ASSERT(byte_offset % sizeof(ElementType) == 0);
6104 6161
6162 CHECK(length <= (std::numeric_limits<size_t>::max() / sizeof(ElementType)));
6163 size_t byte_length = length * sizeof(ElementType);
6105 SetupArrayBufferView( 6164 SetupArrayBufferView(
6106 isolate, obj, buffer, byte_offset, length * sizeof(ElementType)); 6165 isolate, obj, buffer, byte_offset, byte_length);
6107 6166
6108 i::Handle<i::Object> length_object = 6167 i::Handle<i::Object> length_object =
6109 isolate->factory()->NewNumberFromSize(length); 6168 isolate->factory()->NewNumberFromSize(length);
6110 obj->set_length(*length_object); 6169 obj->set_length(*length_object);
6111 6170
6112 i::Handle<i::ExternalArray> elements = 6171 i::Handle<i::ExternalArray> elements =
6113 isolate->factory()->NewExternalArray( 6172 isolate->factory()->NewExternalArray(
6114 static_cast<int>(length), array_type, 6173 static_cast<int>(length), array_type,
6115 static_cast<uint8_t*>(buffer->backing_store()) + byte_offset); 6174 static_cast<uint8_t*>(buffer->backing_store()) + byte_offset);
6116 obj->set_elements(*elements); 6175 obj->set_elements(*elements);
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
6347 SetAddHistogramSampleFunction(callback); 6406 SetAddHistogramSampleFunction(callback);
6348 } 6407 }
6349 6408
6350 void V8::SetFailedAccessCheckCallbackFunction( 6409 void V8::SetFailedAccessCheckCallbackFunction(
6351 FailedAccessCheckCallback callback) { 6410 FailedAccessCheckCallback callback) {
6352 i::Isolate* isolate = i::Isolate::Current(); 6411 i::Isolate* isolate = i::Isolate::Current();
6353 isolate->SetFailedAccessCheckCallback(callback); 6412 isolate->SetFailedAccessCheckCallback(callback);
6354 } 6413 }
6355 6414
6356 6415
6357 intptr_t Isolate::AdjustAmountOfExternalAllocatedMemory( 6416 int64_t Isolate::AdjustAmountOfExternalAllocatedMemory(
6358 intptr_t change_in_bytes) { 6417 int64_t change_in_bytes) {
6359 i::Heap* heap = reinterpret_cast<i::Isolate*>(this)->heap(); 6418 i::Heap* heap = reinterpret_cast<i::Isolate*>(this)->heap();
6360 return heap->AdjustAmountOfExternalAllocatedMemory(change_in_bytes); 6419 return heap->AdjustAmountOfExternalAllocatedMemory(change_in_bytes);
6361 } 6420 }
6362 6421
6363 6422
6364 intptr_t V8::AdjustAmountOfExternalAllocatedMemory(intptr_t change_in_bytes) { 6423 int64_t V8::AdjustAmountOfExternalAllocatedMemory(int64_t change_in_bytes) {
6365 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); 6424 i::Isolate* isolate = i::Isolate::UncheckedCurrent();
6366 if (isolate == NULL || !isolate->IsInitialized()) { 6425 if (isolate == NULL || !isolate->IsInitialized()) {
6367 return 0; 6426 return 0;
6368 } 6427 }
6369 Isolate* isolate_ext = reinterpret_cast<Isolate*>(isolate); 6428 Isolate* isolate_ext = reinterpret_cast<Isolate*>(isolate);
6370 return isolate_ext->AdjustAmountOfExternalAllocatedMemory(change_in_bytes); 6429 return isolate_ext->AdjustAmountOfExternalAllocatedMemory(change_in_bytes);
6371 } 6430 }
6372 6431
6373 6432
6374 HeapProfiler* Isolate::GetHeapProfiler() { 6433 HeapProfiler* Isolate::GetHeapProfiler() {
(...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after
7625 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7684 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7626 Address callback_address = 7685 Address callback_address =
7627 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7686 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7628 VMState<EXTERNAL> state(isolate); 7687 VMState<EXTERNAL> state(isolate);
7629 ExternalCallbackScope call_scope(isolate, callback_address); 7688 ExternalCallbackScope call_scope(isolate, callback_address);
7630 callback(info); 7689 callback(info);
7631 } 7690 }
7632 7691
7633 7692
7634 } } // namespace v8::internal 7693 } } // namespace v8::internal
OLDNEW
« include/v8-platform.h ('K') | « src/allocation-tracker.cc ('k') | src/arguments.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698