| 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 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | 567 |
| 568 | 568 |
| 569 bool SetResourceConstraints(ResourceConstraints* constraints) { | 569 bool SetResourceConstraints(ResourceConstraints* constraints) { |
| 570 i::Isolate* isolate = EnterIsolateIfNeeded(); | 570 i::Isolate* isolate = EnterIsolateIfNeeded(); |
| 571 return SetResourceConstraints(reinterpret_cast<Isolate*>(isolate), |
| 572 constraints); |
| 573 } |
| 571 | 574 |
| 575 |
| 576 bool SetResourceConstraints(Isolate* v8_isolate, |
| 577 ResourceConstraints* constraints) { |
| 578 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); |
| 572 int young_space_size = constraints->max_young_space_size(); | 579 int young_space_size = constraints->max_young_space_size(); |
| 573 int old_gen_size = constraints->max_old_space_size(); | 580 int old_gen_size = constraints->max_old_space_size(); |
| 574 int max_executable_size = constraints->max_executable_size(); | 581 int max_executable_size = constraints->max_executable_size(); |
| 575 if (young_space_size != 0 || old_gen_size != 0 || max_executable_size != 0) { | 582 if (young_space_size != 0 || old_gen_size != 0 || max_executable_size != 0) { |
| 576 // After initialization it's too late to change Heap constraints. | 583 // After initialization it's too late to change Heap constraints. |
| 577 // TODO(rmcilroy): fix this assert. | 584 ASSERT(!isolate->IsInitialized()); |
| 578 // ASSERT(!isolate->IsInitialized()); | |
| 579 bool result = isolate->heap()->ConfigureHeap(young_space_size / 2, | 585 bool result = isolate->heap()->ConfigureHeap(young_space_size / 2, |
| 580 old_gen_size, | 586 old_gen_size, |
| 581 max_executable_size); | 587 max_executable_size); |
| 582 if (!result) return false; | 588 if (!result) return false; |
| 583 } | 589 } |
| 584 if (constraints->stack_limit() != NULL) { | 590 if (constraints->stack_limit() != NULL) { |
| 585 uintptr_t limit = reinterpret_cast<uintptr_t>(constraints->stack_limit()); | 591 uintptr_t limit = reinterpret_cast<uintptr_t>(constraints->stack_limit()); |
| 586 isolate->stack_guard()->SetStackLimit(limit); | 592 isolate->stack_guard()->SetStackLimit(limit); |
| 587 } | 593 } |
| 588 return true; | 594 return true; |
| (...skipping 3093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3682 return Utils::ToLocal(i::Handle<i::Context>(context)); | 3688 return Utils::ToLocal(i::Handle<i::Context>(context)); |
| 3683 } | 3689 } |
| 3684 | 3690 |
| 3685 | 3691 |
| 3686 int v8::Object::GetIdentityHash() { | 3692 int v8::Object::GetIdentityHash() { |
| 3687 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3693 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3688 ON_BAILOUT(isolate, "v8::Object::GetIdentityHash()", return 0); | 3694 ON_BAILOUT(isolate, "v8::Object::GetIdentityHash()", return 0); |
| 3689 ENTER_V8(isolate); | 3695 ENTER_V8(isolate); |
| 3690 i::HandleScope scope(isolate); | 3696 i::HandleScope scope(isolate); |
| 3691 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 3697 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 3692 return i::JSObject::GetIdentityHash(self); | 3698 return i::Handle<i::Smi>::cast( |
| 3699 i::JSReceiver::GetOrCreateIdentityHash(self))->value(); |
| 3693 } | 3700 } |
| 3694 | 3701 |
| 3695 | 3702 |
| 3696 bool v8::Object::SetHiddenValue(v8::Handle<v8::String> key, | 3703 bool v8::Object::SetHiddenValue(v8::Handle<v8::String> key, |
| 3697 v8::Handle<v8::Value> value) { | 3704 v8::Handle<v8::Value> value) { |
| 3698 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3705 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3699 ON_BAILOUT(isolate, "v8::Object::SetHiddenValue()", return false); | 3706 ON_BAILOUT(isolate, "v8::Object::SetHiddenValue()", return false); |
| 3700 if (value.IsEmpty()) return DeleteHiddenValue(key); | 3707 if (value.IsEmpty()) return DeleteHiddenValue(key); |
| 3701 ENTER_V8(isolate); | 3708 ENTER_V8(isolate); |
| 3702 i::HandleScope scope(isolate); | 3709 i::HandleScope scope(isolate); |
| (...skipping 3868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7571 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7578 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 7572 Address callback_address = | 7579 Address callback_address = |
| 7573 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7580 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 7574 VMState<EXTERNAL> state(isolate); | 7581 VMState<EXTERNAL> state(isolate); |
| 7575 ExternalCallbackScope call_scope(isolate, callback_address); | 7582 ExternalCallbackScope call_scope(isolate, callback_address); |
| 7576 callback(info); | 7583 callback(info); |
| 7577 } | 7584 } |
| 7578 | 7585 |
| 7579 | 7586 |
| 7580 } } // namespace v8::internal | 7587 } } // namespace v8::internal |
| OLD | NEW |