| Index: src/api.cc
|
| ===================================================================
|
| --- src/api.cc (revision 7031)
|
| +++ src/api.cc (working copy)
|
| @@ -700,7 +700,7 @@
|
|
|
| void Template::Set(v8::Handle<String> name, v8::Handle<Data> value,
|
| v8::PropertyAttribute attribute) {
|
| - if (IsDeadCheck("v8::Template::SetProperty()")) return;
|
| + if (IsDeadCheck("v8::Template::Set()")) return;
|
| ENTER_V8;
|
| HandleScope scope;
|
| i::Handle<i::Object> list(Utils::OpenHandle(this)->property_list());
|
| @@ -2237,6 +2237,12 @@
|
| ENTER_V8;
|
| i::Handle<i::Object> obj = Utils::OpenHandle(this);
|
| i::Handle<i::Object> other = Utils::OpenHandle(*that);
|
| + // If both obj and other are JSObjects, we'd better compare by identity
|
| + // immediately when going into JS builtin. The reason is Invoke
|
| + // would overwrite global object receiver with global proxy.
|
| + if (obj->IsJSObject() && other->IsJSObject()) {
|
| + return *obj == *other;
|
| + }
|
| i::Object** args[1] = { other.location() };
|
| EXCEPTION_PREAMBLE();
|
| i::Handle<i::Object> result =
|
| @@ -2311,7 +2317,8 @@
|
| self,
|
| key_obj,
|
| value_obj,
|
| - static_cast<PropertyAttributes>(attribs));
|
| + static_cast<PropertyAttributes>(attribs),
|
| + i::kNonStrictMode);
|
| has_pending_exception = obj.is_null();
|
| EXCEPTION_BAILOUT_CHECK(false);
|
| return true;
|
| @@ -2686,26 +2693,38 @@
|
| ENTER_V8;
|
| HandleScope scope;
|
| i::Handle<i::JSObject> self = Utils::OpenHandle(this);
|
| - i::Handle<i::Object> hidden_props(i::GetHiddenProperties(self, true));
|
| - i::Handle<i::Object> hash_symbol = FACTORY->identity_hash_symbol();
|
| - i::Handle<i::Object> hash = i::GetProperty(hidden_props, hash_symbol);
|
| + i::Handle<i::Object> hidden_props_obj(i::GetHiddenProperties(self, true));
|
| + if (!hidden_props_obj->IsJSObject()) {
|
| + // We failed to create hidden properties. That's a detached
|
| + // global proxy.
|
| + ASSERT(hidden_props_obj->IsUndefined());
|
| + return 0;
|
| + }
|
| + i::Handle<i::JSObject> hidden_props =
|
| + i::Handle<i::JSObject>::cast(hidden_props_obj);
|
| + i::Handle<i::String> hash_symbol = FACTORY->identity_hash_symbol();
|
| + if (hidden_props->HasLocalProperty(*hash_symbol)) {
|
| + i::Handle<i::Object> hash = i::GetProperty(hidden_props, hash_symbol);
|
| + CHECK(!hash.is_null());
|
| + CHECK(hash->IsSmi());
|
| + return i::Smi::cast(*hash)->value();
|
| + }
|
| +
|
| int hash_value;
|
| - if (hash->IsSmi()) {
|
| - hash_value = i::Smi::cast(*hash)->value();
|
| - } else {
|
| - int attempts = 0;
|
| - do {
|
| - // Generate a random 32-bit hash value but limit range to fit
|
| - // within a smi.
|
| - hash_value = i::V8::Random(self->GetIsolate()) & i::Smi::kMaxValue;
|
| - attempts++;
|
| - } while (hash_value == 0 && attempts < 30);
|
| - hash_value = hash_value != 0 ? hash_value : 1; // never return 0
|
| - i::SetProperty(hidden_props,
|
| - hash_symbol,
|
| - i::Handle<i::Object>(i::Smi::FromInt(hash_value)),
|
| - static_cast<PropertyAttributes>(None));
|
| - }
|
| + int attempts = 0;
|
| + do {
|
| + // Generate a random 32-bit hash value but limit range to fit
|
| + // within a smi.
|
| + hash_value = i::V8::Random(self->GetIsolate()) & i::Smi::kMaxValue;
|
| + attempts++;
|
| + } while (hash_value == 0 && attempts < 30);
|
| + hash_value = hash_value != 0 ? hash_value : 1; // never return 0
|
| + CHECK(!i::SetLocalPropertyIgnoreAttributes(
|
| + hidden_props,
|
| + hash_symbol,
|
| + i::Handle<i::Object>(i::Smi::FromInt(hash_value)),
|
| + static_cast<PropertyAttributes>(None)).is_null());
|
| +
|
| return hash_value;
|
| }
|
|
|
| @@ -2724,7 +2743,8 @@
|
| hidden_props,
|
| key_obj,
|
| value_obj,
|
| - static_cast<PropertyAttributes>(None));
|
| + static_cast<PropertyAttributes>(None),
|
| + i::kNonStrictMode);
|
| has_pending_exception = obj.is_null();
|
| EXCEPTION_BAILOUT_CHECK(false);
|
| return true;
|
| @@ -2782,9 +2802,9 @@
|
| return;
|
| }
|
| i::Handle<i::PixelArray> pixels = FACTORY->NewPixelArray(length, data);
|
| - i::Handle<i::Map> slow_map =
|
| - FACTORY->GetSlowElementsMap(i::Handle<i::Map>(self->map()));
|
| - self->set_map(*slow_map);
|
| + i::Handle<i::Map> pixel_array_map =
|
| + FACTORY->GetPixelArrayElementsMap(i::Handle<i::Map>(self->map()));
|
| + self->set_map(*pixel_array_map);
|
| self->set_elements(*pixels);
|
| }
|
|
|
|
|