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

Side by Side Diff: src/api.cc

Issue 24205004: Rollback trunk to 3.21.16.2 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 7 years, 3 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
« no previous file with comments | « samples/samples.gyp ('k') | src/apinatives.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 ASSERT(!isolate->IsInitialized()); 617 ASSERT(!isolate->IsInitialized());
618 bool result = isolate->heap()->ConfigureHeap(young_space_size / 2, 618 bool result = isolate->heap()->ConfigureHeap(young_space_size / 2,
619 old_gen_size, 619 old_gen_size,
620 max_executable_size); 620 max_executable_size);
621 if (!result) return false; 621 if (!result) return false;
622 } 622 }
623 if (constraints->stack_limit() != NULL) { 623 if (constraints->stack_limit() != NULL) {
624 uintptr_t limit = reinterpret_cast<uintptr_t>(constraints->stack_limit()); 624 uintptr_t limit = reinterpret_cast<uintptr_t>(constraints->stack_limit());
625 isolate->stack_guard()->SetStackLimit(limit); 625 isolate->stack_guard()->SetStackLimit(limit);
626 } 626 }
627 if (constraints->is_memory_constrained().has_value && 627 if (constraints->is_memory_constrained().has_value) {
628 !i::FLAG_force_memory_constrained.has_value) {
629 isolate->set_is_memory_constrained( 628 isolate->set_is_memory_constrained(
630 constraints->is_memory_constrained().value); 629 constraints->is_memory_constrained().value);
631 } 630 }
632 return true; 631 return true;
633 } 632 }
634 633
635 634
636 i::Object** V8::GlobalizeReference(i::Isolate* isolate, i::Object** obj) { 635 i::Object** V8::GlobalizeReference(i::Isolate* isolate, i::Object** obj) {
637 if (IsDeadCheck(isolate, "V8::Persistent::New")) return NULL; 636 if (IsDeadCheck(isolate, "V8::Persistent::New")) return NULL;
638 LOG_API(isolate, "Persistent::New"); 637 LOG_API(isolate, "Persistent::New");
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after
2050 2049
2051 2050
2052 v8::Local<Value> v8::TryCatch::StackTrace() const { 2051 v8::Local<Value> v8::TryCatch::StackTrace() const {
2053 ASSERT(isolate_ == i::Isolate::Current()); 2052 ASSERT(isolate_ == i::Isolate::Current());
2054 if (HasCaught()) { 2053 if (HasCaught()) {
2055 i::Object* raw_obj = reinterpret_cast<i::Object*>(exception_); 2054 i::Object* raw_obj = reinterpret_cast<i::Object*>(exception_);
2056 if (!raw_obj->IsJSObject()) return v8::Local<Value>(); 2055 if (!raw_obj->IsJSObject()) return v8::Local<Value>();
2057 i::HandleScope scope(isolate_); 2056 i::HandleScope scope(isolate_);
2058 i::Handle<i::JSObject> obj(i::JSObject::cast(raw_obj), isolate_); 2057 i::Handle<i::JSObject> obj(i::JSObject::cast(raw_obj), isolate_);
2059 i::Handle<i::String> name = isolate_->factory()->stack_string(); 2058 i::Handle<i::String> name = isolate_->factory()->stack_string();
2060 if (!i::JSReceiver::HasProperty(obj, name)) return v8::Local<Value>(); 2059 if (!obj->HasProperty(*name)) return v8::Local<Value>();
2061 i::Handle<i::Object> value = i::GetProperty(isolate_, obj, name); 2060 i::Handle<i::Object> value = i::GetProperty(isolate_, obj, name);
2062 if (value.is_null()) return v8::Local<Value>(); 2061 if (value.is_null()) return v8::Local<Value>();
2063 return v8::Utils::ToLocal(scope.CloseAndEscape(value)); 2062 return v8::Utils::ToLocal(scope.CloseAndEscape(value));
2064 } else { 2063 } else {
2065 return v8::Local<Value>(); 2064 return v8::Local<Value>();
2066 } 2065 }
2067 } 2066 }
2068 2067
2069 2068
2070 v8::Local<v8::Message> v8::TryCatch::Message() const { 2069 v8::Local<v8::Message> v8::TryCatch::Message() const {
(...skipping 1548 matching lines...) Expand 10 before | Expand all | Expand 10 after
3619 HandleScope scope(reinterpret_cast<Isolate*>(isolate)); 3618 HandleScope scope(reinterpret_cast<Isolate*>(isolate));
3620 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3619 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
3621 return i::JSReceiver::DeleteElement(self, index)->IsTrue(); 3620 return i::JSReceiver::DeleteElement(self, index)->IsTrue();
3622 } 3621 }
3623 3622
3624 3623
3625 bool v8::Object::Has(uint32_t index) { 3624 bool v8::Object::Has(uint32_t index) {
3626 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3625 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3627 ON_BAILOUT(isolate, "v8::Object::HasProperty()", return false); 3626 ON_BAILOUT(isolate, "v8::Object::HasProperty()", return false);
3628 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3627 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
3629 return i::JSReceiver::HasElement(self, index); 3628 return self->HasElement(index);
3630 } 3629 }
3631 3630
3632 3631
3633 template<typename Setter, typename Getter, typename Data> 3632 template<typename Setter, typename Getter, typename Data>
3634 static inline bool ObjectSetAccessor(Object* obj, 3633 static inline bool ObjectSetAccessor(Object* obj,
3635 Handle<String> name, 3634 Handle<String> name,
3636 Setter getter, 3635 Setter getter,
3637 Getter setter, 3636 Getter setter,
3638 Data data, 3637 Data data,
3639 AccessControl settings, 3638 AccessControl settings,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
3673 void* null = NULL; 3672 void* null = NULL;
3674 return ObjectSetAccessor( 3673 return ObjectSetAccessor(
3675 this, name, descriptor, null, null, settings, attributes); 3674 this, name, descriptor, null, null, settings, attributes);
3676 } 3675 }
3677 3676
3678 3677
3679 bool v8::Object::HasOwnProperty(Handle<String> key) { 3678 bool v8::Object::HasOwnProperty(Handle<String> key) {
3680 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3679 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3681 ON_BAILOUT(isolate, "v8::Object::HasOwnProperty()", 3680 ON_BAILOUT(isolate, "v8::Object::HasOwnProperty()",
3682 return false); 3681 return false);
3683 return i::JSReceiver::HasLocalProperty( 3682 return Utils::OpenHandle(this)->HasLocalProperty(
3684 Utils::OpenHandle(this), Utils::OpenHandle(*key)); 3683 *Utils::OpenHandle(*key));
3685 } 3684 }
3686 3685
3687 3686
3688 bool v8::Object::HasRealNamedProperty(Handle<String> key) { 3687 bool v8::Object::HasRealNamedProperty(Handle<String> key) {
3689 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3688 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3690 ON_BAILOUT(isolate, "v8::Object::HasRealNamedProperty()", 3689 ON_BAILOUT(isolate, "v8::Object::HasRealNamedProperty()",
3691 return false); 3690 return false);
3692 return Utils::OpenHandle(this)->HasRealNamedProperty( 3691 return Utils::OpenHandle(this)->HasRealNamedProperty(
3693 isolate, 3692 isolate,
3694 *Utils::OpenHandle(*key)); 3693 *Utils::OpenHandle(*key));
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
3807 return Utils::OpenHandle(this)->IsDirty(); 3806 return Utils::OpenHandle(this)->IsDirty();
3808 } 3807 }
3809 3808
3810 3809
3811 Local<v8::Object> v8::Object::Clone() { 3810 Local<v8::Object> v8::Object::Clone() {
3812 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3811 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3813 ON_BAILOUT(isolate, "v8::Object::Clone()", return Local<Object>()); 3812 ON_BAILOUT(isolate, "v8::Object::Clone()", return Local<Object>());
3814 ENTER_V8(isolate); 3813 ENTER_V8(isolate);
3815 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3814 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
3816 EXCEPTION_PREAMBLE(isolate); 3815 EXCEPTION_PREAMBLE(isolate);
3817 i::Handle<i::JSObject> result = i::JSObject::Copy(self); 3816 i::Handle<i::JSObject> result = i::Copy(self);
3818 has_pending_exception = result.is_null(); 3817 has_pending_exception = result.is_null();
3819 EXCEPTION_BAILOUT_CHECK(isolate, Local<Object>()); 3818 EXCEPTION_BAILOUT_CHECK(isolate, Local<Object>());
3820 return Utils::ToLocal(result); 3819 return Utils::ToLocal(result);
3821 } 3820 }
3822 3821
3823 3822
3824 static i::Context* GetCreationContext(i::JSObject* object) { 3823 static i::Context* GetCreationContext(i::JSObject* object) {
3825 i::Object* constructor = object->map()->constructor(); 3824 i::Object* constructor = object->map()->constructor();
3826 i::JSFunction* function; 3825 i::JSFunction* function;
3827 if (!constructor->IsJSFunction()) { 3826 if (!constructor->IsJSFunction()) {
(...skipping 2378 matching lines...) Expand 10 before | Expand all | Expand 10 after
6206 return Local<Object>(); 6205 return Local<Object>();
6207 } 6206 }
6208 i::FixedArray* elms = i::FixedArray::cast(self->elements()); 6207 i::FixedArray* elms = i::FixedArray::cast(self->elements());
6209 i::Object* paragon = elms->get(index); 6208 i::Object* paragon = elms->get(index);
6210 if (!paragon->IsJSObject()) { 6209 if (!paragon->IsJSObject()) {
6211 return Local<Object>(); 6210 return Local<Object>();
6212 } 6211 }
6213 i::Handle<i::JSObject> paragon_handle(i::JSObject::cast(paragon)); 6212 i::Handle<i::JSObject> paragon_handle(i::JSObject::cast(paragon));
6214 EXCEPTION_PREAMBLE(isolate); 6213 EXCEPTION_PREAMBLE(isolate);
6215 ENTER_V8(isolate); 6214 ENTER_V8(isolate);
6216 i::Handle<i::JSObject> result = i::JSObject::Copy(paragon_handle); 6215 i::Handle<i::JSObject> result = i::Copy(paragon_handle);
6217 has_pending_exception = result.is_null(); 6216 has_pending_exception = result.is_null();
6218 EXCEPTION_BAILOUT_CHECK(isolate, Local<Object>()); 6217 EXCEPTION_BAILOUT_CHECK(isolate, Local<Object>());
6219 return Utils::ToLocal(result); 6218 return Utils::ToLocal(result);
6220 } 6219 }
6221 6220
6222 6221
6223 bool v8::ArrayBuffer::IsExternal() const { 6222 bool v8::ArrayBuffer::IsExternal() const {
6224 return Utils::OpenHandle(this)->is_external(); 6223 return Utils::OpenHandle(this)->is_external();
6225 } 6224 }
6226 6225
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
6679 void Isolate::SetReference(const Persistent<Object>& parent, 6678 void Isolate::SetReference(const Persistent<Object>& parent,
6680 const Persistent<Value>& child) { 6679 const Persistent<Value>& child) {
6681 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this); 6680 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this);
6682 i::Object** parent_location = Utils::OpenPersistent(parent).location(); 6681 i::Object** parent_location = Utils::OpenPersistent(parent).location();
6683 internal_isolate->global_handles()->SetReference( 6682 internal_isolate->global_handles()->SetReference(
6684 reinterpret_cast<i::HeapObject**>(parent_location), 6683 reinterpret_cast<i::HeapObject**>(parent_location),
6685 Utils::OpenPersistent(child).location()); 6684 Utils::OpenPersistent(child).location());
6686 } 6685 }
6687 6686
6688 6687
6689 void Isolate::AddGCPrologueCallback(GCPrologueCallback callback, 6688 void V8::SetGlobalGCPrologueCallback(GCCallback callback) {
6690 GCType gc_type) { 6689 i::Isolate* isolate = i::Isolate::Current();
6691 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 6690 if (IsDeadCheck(isolate, "v8::V8::SetGlobalGCPrologueCallback()")) return;
6692 isolate->heap()->AddGCPrologueCallback(callback, gc_type); 6691 isolate->heap()->SetGlobalGCPrologueCallback(callback);
6693 } 6692 }
6694 6693
6695 6694
6696 void Isolate::RemoveGCPrologueCallback(GCPrologueCallback callback) { 6695 void V8::SetGlobalGCEpilogueCallback(GCCallback callback) {
6697 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 6696 i::Isolate* isolate = i::Isolate::Current();
6698 isolate->heap()->RemoveGCPrologueCallback(callback); 6697 if (IsDeadCheck(isolate, "v8::V8::SetGlobalGCEpilogueCallback()")) return;
6699 } 6698 isolate->heap()->SetGlobalGCEpilogueCallback(callback);
6700
6701
6702 void Isolate::AddGCEpilogueCallback(GCEpilogueCallback callback,
6703 GCType gc_type) {
6704 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6705 isolate->heap()->AddGCEpilogueCallback(callback, gc_type);
6706 }
6707
6708
6709 void Isolate::RemoveGCEpilogueCallback(GCEpilogueCallback callback) {
6710 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6711 isolate->heap()->RemoveGCEpilogueCallback(callback);
6712 } 6699 }
6713 6700
6714 6701
6715 void V8::AddGCPrologueCallback(GCPrologueCallback callback, GCType gc_type) { 6702 void V8::AddGCPrologueCallback(GCPrologueCallback callback, GCType gc_type) {
6716 i::Isolate* isolate = i::Isolate::Current(); 6703 i::Isolate* isolate = i::Isolate::Current();
6717 if (IsDeadCheck(isolate, "v8::V8::AddGCPrologueCallback()")) return; 6704 if (IsDeadCheck(isolate, "v8::V8::AddGCPrologueCallback()")) return;
6718 isolate->heap()->AddGCPrologueCallback( 6705 isolate->heap()->AddGCPrologueCallback(callback, gc_type);
6719 reinterpret_cast<v8::Isolate::GCPrologueCallback>(callback),
6720 gc_type,
6721 false);
6722 } 6706 }
6723 6707
6724 6708
6725 void V8::RemoveGCPrologueCallback(GCPrologueCallback callback) { 6709 void V8::RemoveGCPrologueCallback(GCPrologueCallback callback) {
6726 i::Isolate* isolate = i::Isolate::Current(); 6710 i::Isolate* isolate = i::Isolate::Current();
6727 if (IsDeadCheck(isolate, "v8::V8::RemoveGCPrologueCallback()")) return; 6711 if (IsDeadCheck(isolate, "v8::V8::RemoveGCPrologueCallback()")) return;
6728 isolate->heap()->RemoveGCPrologueCallback( 6712 isolate->heap()->RemoveGCPrologueCallback(callback);
6729 reinterpret_cast<v8::Isolate::GCPrologueCallback>(callback));
6730 } 6713 }
6731 6714
6732 6715
6733 void V8::AddGCEpilogueCallback(GCEpilogueCallback callback, GCType gc_type) { 6716 void V8::AddGCEpilogueCallback(GCEpilogueCallback callback, GCType gc_type) {
6734 i::Isolate* isolate = i::Isolate::Current(); 6717 i::Isolate* isolate = i::Isolate::Current();
6735 if (IsDeadCheck(isolate, "v8::V8::AddGCEpilogueCallback()")) return; 6718 if (IsDeadCheck(isolate, "v8::V8::AddGCEpilogueCallback()")) return;
6736 isolate->heap()->AddGCEpilogueCallback( 6719 isolate->heap()->AddGCEpilogueCallback(callback, gc_type);
6737 reinterpret_cast<v8::Isolate::GCEpilogueCallback>(callback),
6738 gc_type,
6739 false);
6740 } 6720 }
6741 6721
6742 6722
6743 void V8::RemoveGCEpilogueCallback(GCEpilogueCallback callback) { 6723 void V8::RemoveGCEpilogueCallback(GCEpilogueCallback callback) {
6744 i::Isolate* isolate = i::Isolate::Current(); 6724 i::Isolate* isolate = i::Isolate::Current();
6745 if (IsDeadCheck(isolate, "v8::V8::RemoveGCEpilogueCallback()")) return; 6725 if (IsDeadCheck(isolate, "v8::V8::RemoveGCEpilogueCallback()")) return;
6746 isolate->heap()->RemoveGCEpilogueCallback( 6726 isolate->heap()->RemoveGCEpilogueCallback(callback);
6747 reinterpret_cast<v8::Isolate::GCEpilogueCallback>(callback));
6748 } 6727 }
6749 6728
6750 6729
6751 void V8::AddMemoryAllocationCallback(MemoryAllocationCallback callback, 6730 void V8::AddMemoryAllocationCallback(MemoryAllocationCallback callback,
6752 ObjectSpace space, 6731 ObjectSpace space,
6753 AllocationAction action) { 6732 AllocationAction action) {
6754 i::Isolate* isolate = i::Isolate::Current(); 6733 i::Isolate* isolate = i::Isolate::Current();
6755 if (IsDeadCheck(isolate, "v8::V8::AddMemoryAllocationCallback()")) return; 6734 if (IsDeadCheck(isolate, "v8::V8::AddMemoryAllocationCallback()")) return;
6756 isolate->memory_allocator()->AddMemoryAllocationCallback( 6735 isolate->memory_allocator()->AddMemoryAllocationCallback(
6757 callback, space, action); 6736 callback, space, action);
(...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after
7885 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7864 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7886 Address callback_address = 7865 Address callback_address =
7887 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7866 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7888 VMState<EXTERNAL> state(isolate); 7867 VMState<EXTERNAL> state(isolate);
7889 ExternalCallbackScope call_scope(isolate, callback_address); 7868 ExternalCallbackScope call_scope(isolate, callback_address);
7890 callback(info); 7869 callback(info);
7891 } 7870 }
7892 7871
7893 7872
7894 } } // namespace v8::internal 7873 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « samples/samples.gyp ('k') | src/apinatives.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698