| 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 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 898 result = *value; | 898 result = *value; |
| 899 } | 899 } |
| 900 is_closed_ = true; | 900 is_closed_ = true; |
| 901 Leave(); | 901 Leave(); |
| 902 | 902 |
| 903 if (value == NULL) { | 903 if (value == NULL) { |
| 904 return NULL; | 904 return NULL; |
| 905 } | 905 } |
| 906 | 906 |
| 907 // Allocate a new handle on the previous handle block. | 907 // Allocate a new handle on the previous handle block. |
| 908 i::Handle<i::Object> handle(result); | 908 i::Handle<i::Object> handle(result, isolate_); |
| 909 return handle.location(); | 909 return handle.location(); |
| 910 } | 910 } |
| 911 | 911 |
| 912 | 912 |
| 913 // --- N e a n d e r --- | 913 // --- N e a n d e r --- |
| 914 | 914 |
| 915 | 915 |
| 916 // A constructor cannot easily return an error value, therefore it is necessary | 916 // A constructor cannot easily return an error value, therefore it is necessary |
| 917 // to check for a dead VM with ON_BAILOUT before constructing any Neander | 917 // to check for a dead VM with ON_BAILOUT before constructing any Neander |
| 918 // objects. To remind you about this there is no HandleScope in the | 918 // objects. To remind you about this there is no HandleScope in the |
| (...skipping 2488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3407 | 3407 |
| 3408 | 3408 |
| 3409 v8::Local<v8::Value> v8::Object::GetHiddenValue(v8::Handle<v8::String> key) { | 3409 v8::Local<v8::Value> v8::Object::GetHiddenValue(v8::Handle<v8::String> key) { |
| 3410 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3410 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3411 ON_BAILOUT(isolate, "v8::Object::GetHiddenValue()", | 3411 ON_BAILOUT(isolate, "v8::Object::GetHiddenValue()", |
| 3412 return Local<v8::Value>()); | 3412 return Local<v8::Value>()); |
| 3413 ENTER_V8(isolate); | 3413 ENTER_V8(isolate); |
| 3414 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 3414 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 3415 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); | 3415 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); |
| 3416 i::Handle<i::String> key_symbol = FACTORY->LookupSymbol(key_obj); | 3416 i::Handle<i::String> key_symbol = FACTORY->LookupSymbol(key_obj); |
| 3417 i::Handle<i::Object> result(self->GetHiddenProperty(*key_symbol)); | 3417 i::Handle<i::Object> result(self->GetHiddenProperty(*key_symbol), isolate); |
| 3418 if (result->IsUndefined()) return v8::Local<v8::Value>(); | 3418 if (result->IsUndefined()) return v8::Local<v8::Value>(); |
| 3419 return Utils::ToLocal(result); | 3419 return Utils::ToLocal(result); |
| 3420 } | 3420 } |
| 3421 | 3421 |
| 3422 | 3422 |
| 3423 bool v8::Object::DeleteHiddenValue(v8::Handle<v8::String> key) { | 3423 bool v8::Object::DeleteHiddenValue(v8::Handle<v8::String> key) { |
| 3424 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3424 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3425 ON_BAILOUT(isolate, "v8::DeleteHiddenValue()", return false); | 3425 ON_BAILOUT(isolate, "v8::DeleteHiddenValue()", return false); |
| 3426 ENTER_V8(isolate); | 3426 ENTER_V8(isolate); |
| 3427 i::HandleScope scope(isolate); | 3427 i::HandleScope scope(isolate); |
| (...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4642 } | 4642 } |
| 4643 i::Handle<i::Object> calling = | 4643 i::Handle<i::Object> calling = |
| 4644 isolate->GetCallingNativeContext(); | 4644 isolate->GetCallingNativeContext(); |
| 4645 if (calling.is_null()) return Local<Context>(); | 4645 if (calling.is_null()) return Local<Context>(); |
| 4646 i::Handle<i::Context> context = i::Handle<i::Context>::cast(calling); | 4646 i::Handle<i::Context> context = i::Handle<i::Context>::cast(calling); |
| 4647 return Utils::ToLocal(context); | 4647 return Utils::ToLocal(context); |
| 4648 } | 4648 } |
| 4649 | 4649 |
| 4650 | 4650 |
| 4651 v8::Local<v8::Object> Context::Global() { | 4651 v8::Local<v8::Object> Context::Global() { |
| 4652 if (IsDeadCheck(i::Isolate::Current(), "v8::Context::Global()")) { | 4652 i::Isolate* isolate = i::Isolate::Current(); |
| 4653 if (IsDeadCheck(isolate, "v8::Context::Global()")) { |
| 4653 return Local<v8::Object>(); | 4654 return Local<v8::Object>(); |
| 4654 } | 4655 } |
| 4655 i::Object** ctx = reinterpret_cast<i::Object**>(this); | 4656 i::Object** ctx = reinterpret_cast<i::Object**>(this); |
| 4656 i::Handle<i::Context> context = | 4657 i::Handle<i::Context> context = |
| 4657 i::Handle<i::Context>::cast(i::Handle<i::Object>(ctx)); | 4658 i::Handle<i::Context>::cast(i::Handle<i::Object>(ctx)); |
| 4658 i::Handle<i::Object> global(context->global_proxy()); | 4659 i::Handle<i::Object> global(context->global_proxy(), isolate); |
| 4659 return Utils::ToLocal(i::Handle<i::JSObject>::cast(global)); | 4660 return Utils::ToLocal(i::Handle<i::JSObject>::cast(global)); |
| 4660 } | 4661 } |
| 4661 | 4662 |
| 4662 | 4663 |
| 4663 void Context::DetachGlobal() { | 4664 void Context::DetachGlobal() { |
| 4664 i::Isolate* isolate = i::Isolate::Current(); | 4665 i::Isolate* isolate = i::Isolate::Current(); |
| 4665 if (IsDeadCheck(isolate, "v8::Context::DetachGlobal()")) return; | 4666 if (IsDeadCheck(isolate, "v8::Context::DetachGlobal()")) return; |
| 4666 ENTER_V8(isolate); | 4667 ENTER_V8(isolate); |
| 4667 i::Object** ctx = reinterpret_cast<i::Object**>(this); | 4668 i::Object** ctx = reinterpret_cast<i::Object**>(this); |
| 4668 i::Handle<i::Context> context = | 4669 i::Handle<i::Context> context = |
| (...skipping 1995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6664 | 6665 |
| 6665 v->VisitPointers(blocks_.first(), first_block_limit_); | 6666 v->VisitPointers(blocks_.first(), first_block_limit_); |
| 6666 | 6667 |
| 6667 for (int i = 1; i < blocks_.length(); i++) { | 6668 for (int i = 1; i < blocks_.length(); i++) { |
| 6668 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); | 6669 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); |
| 6669 } | 6670 } |
| 6670 } | 6671 } |
| 6671 | 6672 |
| 6672 | 6673 |
| 6673 } } // namespace v8::internal | 6674 } } // namespace v8::internal |
| OLD | NEW |