| Index: src/api.cc
|
| diff --git a/src/api.cc b/src/api.cc
|
| index 962723d4e8811b831b1f637b003a1e32a5dd887f..2df31df35330a0278c3a5a6472bddd9c08a4c48a 100644
|
| --- a/src/api.cc
|
| +++ b/src/api.cc
|
| @@ -457,19 +457,37 @@ void V8::DisposeGlobal(i::Object** obj) {
|
| // --- H a n d l e s ---
|
|
|
|
|
| -HandleScope::HandleScope() : is_closed_(false) {
|
| +HandleScope::HandleScope()
|
| + : prev_next_(i::HandleScope::current_.next),
|
| + prev_limit_(i::HandleScope::current_.limit),
|
| + is_closed_(false) {
|
| API_ENTRY_CHECK("HandleScope::HandleScope");
|
| - i::HandleScope::Enter(&previous_);
|
| + i::HandleScope::current_.level++;
|
| }
|
|
|
|
|
| HandleScope::~HandleScope() {
|
| if (!is_closed_) {
|
| - i::HandleScope::Leave(&previous_);
|
| + Leave();
|
| }
|
| }
|
|
|
|
|
| +void HandleScope::Leave() {
|
| + i::HandleScope::current_.level--;
|
| + ASSERT(i::HandleScope::current_.level >= 0);
|
| + i::HandleScope::current_.next = prev_next_;
|
| + if (i::HandleScope::current_.limit != prev_limit_) {
|
| + i::HandleScope::current_.limit = prev_limit_;
|
| + i::HandleScope::DeleteExtensions();
|
| + }
|
| +
|
| +#ifdef DEBUG
|
| + i::HandleScope::ZapRange(prev_next_, prev_limit_);
|
| +#endif
|
| +}
|
| +
|
| +
|
| int HandleScope::NumberOfHandles() {
|
| return i::HandleScope::NumberOfHandles();
|
| }
|
| @@ -553,7 +571,7 @@ i::Object** v8::HandleScope::RawClose(i::Object** value) {
|
| result = *value;
|
| }
|
| is_closed_ = true;
|
| - i::HandleScope::Leave(&previous_);
|
| + Leave();
|
|
|
| if (value == NULL) {
|
| return NULL;
|
| @@ -1489,7 +1507,8 @@ static i::Handle<i::Object> CallV8HeapFunction(const char* name,
|
| i::Object** argv[],
|
| bool* has_pending_exception) {
|
| i::Handle<i::String> fmt_str = i::Factory::LookupAsciiSymbol(name);
|
| - i::Object* object_fun = i::Top::builtins()->GetProperty(*fmt_str);
|
| + i::Object* object_fun =
|
| + i::Top::builtins()->GetPropertyNoExceptionThrown(*fmt_str);
|
| i::Handle<i::JSFunction> fun =
|
| i::Handle<i::JSFunction>(i::JSFunction::cast(object_fun));
|
| i::Handle<i::Object> value =
|
| @@ -1605,7 +1624,8 @@ Local<StackFrame> StackTrace::GetFrame(uint32_t index) const {
|
| ENTER_V8;
|
| HandleScope scope;
|
| i::Handle<i::JSArray> self = Utils::OpenHandle(this);
|
| - i::Handle<i::JSObject> obj(i::JSObject::cast(self->GetElement(index)));
|
| + i::Object* raw_object = self->GetElementNoExceptionThrown(index);
|
| + i::Handle<i::JSObject> obj(i::JSObject::cast(raw_object));
|
| return scope.Close(Utils::StackFrameToLocal(obj));
|
| }
|
|
|
| @@ -2521,10 +2541,12 @@ Local<Value> v8::Object::GetRealNamedPropertyInPrototypeChain(
|
| self_obj->LookupRealNamedPropertyInPrototypes(*key_obj, &lookup);
|
| if (lookup.IsProperty()) {
|
| PropertyAttributes attributes;
|
| - i::Handle<i::Object> result(self_obj->GetProperty(*self_obj,
|
| - &lookup,
|
| - *key_obj,
|
| - &attributes));
|
| + i::Object* property =
|
| + self_obj->GetProperty(*self_obj,
|
| + &lookup,
|
| + *key_obj,
|
| + &attributes)->ToObjectUnchecked();
|
| + i::Handle<i::Object> result(property);
|
| return Utils::ToLocal(result);
|
| }
|
| return Local<Value>(); // No real property was found in prototype chain.
|
| @@ -2540,10 +2562,12 @@ Local<Value> v8::Object::GetRealNamedProperty(Handle<String> key) {
|
| self_obj->LookupRealNamedProperty(*key_obj, &lookup);
|
| if (lookup.IsProperty()) {
|
| PropertyAttributes attributes;
|
| - i::Handle<i::Object> result(self_obj->GetProperty(*self_obj,
|
| - &lookup,
|
| - *key_obj,
|
| - &attributes));
|
| + i::Object* property =
|
| + self_obj->GetProperty(*self_obj,
|
| + &lookup,
|
| + *key_obj,
|
| + &attributes)->ToObjectUnchecked();
|
| + i::Handle<i::Object> result(property);
|
| return Utils::ToLocal(result);
|
| }
|
| return Local<Value>(); // No real property was found in prototype chain.
|
|
|