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

Unified Diff: src/runtime.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime.h ('k') | src/stub-cache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 7c240e25de2b333c54bfb9ee8a6f1699c153b2f6..c09fb1d49904585d0eb6f673d350de65c8c38abb 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -499,10 +499,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateObjectLiteral) {
// Update the functions literal and return the boilerplate.
literals->set(literals_index, *boilerplate);
}
-
- Handle<Object> copy = JSObject::DeepCopy(Handle<JSObject>::cast(boilerplate));
- RETURN_IF_EMPTY_HANDLE(isolate, copy);
- return *copy;
+ return JSObject::cast(*boilerplate)->DeepCopy(isolate);
}
@@ -567,10 +564,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteral) {
literals_index, elements);
RETURN_IF_EMPTY_HANDLE(isolate, site);
- Handle<JSObject> boilerplate(JSObject::cast(site->transition_info()));
- Handle<JSObject> copy = JSObject::DeepCopy(boilerplate);
- RETURN_IF_EMPTY_HANDLE(isolate, copy);
- return *copy;
+ JSObject* boilerplate = JSObject::cast(site->transition_info());
+ return boilerplate->DeepCopy(isolate);
}
@@ -2169,7 +2164,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DeclareContextSlot) {
// Declare the property by setting it to the initial value if provided,
// or undefined, and use the correct mode (e.g. READ_ONLY attribute for
// constant declarations).
- ASSERT(!JSReceiver::HasLocalProperty(object, name));
+ ASSERT(!object->HasLocalProperty(*name));
Handle<Object> value(isolate->heap()->undefined_value(), isolate);
if (*initial_value != NULL) value = initial_value;
// Declaring a const context slot is a conflicting declaration if
@@ -2201,7 +2196,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DeclareContextSlot) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeVarGlobal) {
- HandleScope scope(isolate);
+ SealHandleScope shs(isolate);
// args[0] == name
// args[1] == language_mode
// args[2] == value (optional)
@@ -2212,6 +2207,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeVarGlobal) {
bool assign = args.length() == 3;
CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
+ GlobalObject* global = isolate->context()->global_object();
RUNTIME_ASSERT(args[1]->IsSmi());
CONVERT_LANGUAGE_MODE_ARG(language_mode, 1);
StrictModeFlag strict_mode_flag = (language_mode == CLASSIC_MODE)
@@ -2228,33 +2224,28 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeVarGlobal) {
// to assign to the property.
// Note that objects can have hidden prototypes, so we need to traverse
// the whole chain of hidden prototypes to do a 'local' lookup.
+ Object* object = global;
LookupResult lookup(isolate);
- isolate->context()->global_object()->LocalLookup(*name, &lookup, true);
+ JSObject::cast(object)->LocalLookup(*name, &lookup, true);
if (lookup.IsInterceptor()) {
+ HandleScope handle_scope(isolate);
PropertyAttributes intercepted =
lookup.holder()->GetPropertyAttribute(*name);
if (intercepted != ABSENT && (intercepted & READ_ONLY) == 0) {
// Found an interceptor that's not read only.
if (assign) {
- CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
- Handle<Object> result = JSObject::SetPropertyForResult(
- handle(lookup.holder()), &lookup, name, value, attributes,
- strict_mode_flag);
- RETURN_IF_EMPTY_HANDLE(isolate, result);
- return *result;
+ return lookup.holder()->SetProperty(
+ &lookup, *name, args[2], attributes, strict_mode_flag);
} else {
return isolate->heap()->undefined_value();
}
}
}
+ // Reload global in case the loop above performed a GC.
+ global = isolate->context()->global_object();
if (assign) {
- CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
- Handle<GlobalObject> global(isolate->context()->global_object());
- Handle<Object> result = JSReceiver::SetProperty(
- global, name, value, attributes, strict_mode_flag);
- RETURN_IF_EMPTY_HANDLE(isolate, result);
- return *result;
+ return global->SetProperty(*name, args[2], attributes, strict_mode_flag);
}
return isolate->heap()->undefined_value();
}
@@ -4787,7 +4778,7 @@ MaybeObject* Runtime::HasObjectProperty(Isolate* isolate,
// Check if the given key is an array index.
uint32_t index;
if (key->ToArrayIndex(&index)) {
- return isolate->heap()->ToBoolean(JSReceiver::HasElement(object, index));
+ return isolate->heap()->ToBoolean(object->HasElement(index));
}
// Convert the key to a name - possibly by calling back into JavaScript.
@@ -4802,7 +4793,7 @@ MaybeObject* Runtime::HasObjectProperty(Isolate* isolate,
name = Handle<Name>::cast(converted);
}
- return isolate->heap()->ToBoolean(JSReceiver::HasProperty(object, name));
+ return isolate->heap()->ToBoolean(object->HasProperty(*name));
}
MaybeObject* Runtime::GetObjectPropertyOrFail(
@@ -5137,14 +5128,11 @@ MaybeObject* Runtime::SetObjectProperty(Isolate* isolate,
if (object->IsJSProxy()) {
bool has_pending_exception = false;
- Handle<Object> name_object = key->IsSymbol()
+ Handle<Object> name = key->IsSymbol()
? key : Execution::ToString(isolate, key, &has_pending_exception);
if (has_pending_exception) return Failure::Exception();
- Handle<Name> name = Handle<Name>::cast(name_object);
- Handle<Object> result = JSReceiver::SetProperty(
- Handle<JSProxy>::cast(object), name, value, attr, strict_mode);
- RETURN_IF_EMPTY_HANDLE(isolate, result);
- return *result;
+ return JSProxy::cast(*object)->SetProperty(
+ Name::cast(*name), *value, attr, strict_mode);
}
// If the object isn't a JavaScript object, we ignore the store.
@@ -5184,6 +5172,7 @@ MaybeObject* Runtime::SetObjectProperty(Isolate* isolate,
}
if (key->IsName()) {
+ MaybeObject* result;
Handle<Name> name = Handle<Name>::cast(key);
if (name->AsArrayIndex(&index)) {
if (js_object->HasExternalArrayElements()) {
@@ -5195,15 +5184,13 @@ MaybeObject* Runtime::SetObjectProperty(Isolate* isolate,
value = number;
}
}
- MaybeObject* result = js_object->SetElement(
+ result = js_object->SetElement(
index, *value, attr, strict_mode, true, set_mode);
- if (result->IsFailure()) return result;
} else {
if (name->IsString()) Handle<String>::cast(name)->TryFlatten();
- Handle<Object> result =
- JSReceiver::SetProperty(js_object, name, value, attr, strict_mode);
- RETURN_IF_EMPTY_HANDLE(isolate, result);
+ result = js_object->SetProperty(*name, *value, attr, strict_mode);
}
+ if (result->IsFailure()) return result;
return *value;
}
@@ -5218,10 +5205,7 @@ MaybeObject* Runtime::SetObjectProperty(Isolate* isolate,
return js_object->SetElement(
index, *value, attr, strict_mode, true, set_mode);
} else {
- Handle<Object> result =
- JSReceiver::SetProperty(js_object, name, value, attr, strict_mode);
- RETURN_IF_EMPTY_HANDLE(isolate, result);
- return *result;
+ return js_object->SetProperty(*name, *value, attr, strict_mode);
}
}
@@ -5520,9 +5504,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DeleteProperty) {
static MaybeObject* HasLocalPropertyImplementation(Isolate* isolate,
Handle<JSObject> object,
Handle<Name> key) {
- if (JSReceiver::HasLocalProperty(object, key)) {
- return isolate->heap()->true_value();
- }
+ if (object->HasLocalProperty(*key)) return isolate->heap()->true_value();
// Handle hidden prototypes. If there's a hidden prototype above this thing
// then we have to check it for properties, because they are supposed to
// look like they are on this object.
@@ -5582,12 +5564,12 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_HasLocalProperty) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_HasProperty) {
- HandleScope scope(isolate);
+ SealHandleScope shs(isolate);
ASSERT(args.length() == 2);
- CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0);
- CONVERT_ARG_HANDLE_CHECKED(Name, key, 1);
+ CONVERT_ARG_CHECKED(JSReceiver, receiver, 0);
+ CONVERT_ARG_CHECKED(Name, key, 1);
- bool result = JSReceiver::HasProperty(receiver, key);
+ bool result = receiver->HasProperty(key);
RETURN_IF_SCHEDULED_EXCEPTION(isolate);
if (isolate->has_pending_exception()) return Failure::Exception();
return isolate->heap()->ToBoolean(result);
@@ -5595,12 +5577,12 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_HasProperty) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_HasElement) {
- HandleScope scope(isolate);
+ SealHandleScope shs(isolate);
ASSERT(args.length() == 2);
- CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0);
+ CONVERT_ARG_CHECKED(JSReceiver, receiver, 0);
CONVERT_SMI_ARG_CHECKED(index, 1);
- bool result = JSReceiver::HasElement(receiver, index);
+ bool result = receiver->HasElement(index);
RETURN_IF_SCHEDULED_EXCEPTION(isolate);
if (isolate->has_pending_exception()) return Failure::Exception();
return isolate->heap()->ToBoolean(result);
@@ -9211,7 +9193,7 @@ static ObjectPair LoadContextSlotHelper(Arguments args,
// property from it.
if (!holder.is_null()) {
Handle<JSReceiver> object = Handle<JSReceiver>::cast(holder);
- ASSERT(object->IsJSProxy() || JSReceiver::HasProperty(object, name));
+ ASSERT(object->IsJSProxy() || object->HasProperty(*name));
// GetProperty below can cause GC.
Handle<Object> receiver_handle(
object->IsGlobalObject()
@@ -10192,7 +10174,7 @@ static bool IterateElements(Isolate* isolate,
Handle<Object> element_value(elements->get(j), isolate);
if (!element_value->IsTheHole()) {
visitor->visit(j, element_value);
- } else if (JSReceiver::HasElement(receiver, j)) {
+ } else if (receiver->HasElement(j)) {
// Call GetElement on receiver, not its prototype, or getters won't
// have the correct receiver.
element_value = Object::GetElement(isolate, receiver, j);
@@ -10217,7 +10199,7 @@ static bool IterateElements(Isolate* isolate,
Handle<Object> element_value =
isolate->factory()->NewNumber(double_value);
visitor->visit(j, element_value);
- } else if (JSReceiver::HasElement(receiver, j)) {
+ } else if (receiver->HasElement(j)) {
// Call GetElement on receiver, not its prototype, or getters won't
// have the correct receiver.
Handle<Object> element_value =
@@ -11533,7 +11515,7 @@ static bool SetLocalVariableValue(Isolate* isolate,
!function_context->IsNativeContext()) {
Handle<JSObject> ext(JSObject::cast(function_context->extension()));
- if (JSReceiver::HasProperty(ext, variable_name)) {
+ if (ext->HasProperty(*variable_name)) {
// We don't expect this to do anything except replacing
// property value.
SetProperty(isolate,
@@ -11621,7 +11603,7 @@ static bool SetClosureVariableValue(Isolate* isolate,
// be variables introduced by eval.
if (context->has_extension()) {
Handle<JSObject> ext(JSObject::cast(context->extension()));
- if (JSReceiver::HasProperty(ext, variable_name)) {
+ if (ext->HasProperty(*variable_name)) {
// We don't expect this to do anything except replacing property value.
SetProperty(isolate,
ext,
@@ -12664,8 +12646,7 @@ static Handle<JSObject> MaterializeArgumentsObject(
// Do not materialize the arguments object for eval or top-level code.
// Skip if "arguments" is already taken.
if (!function->shared()->is_function() ||
- JSReceiver::HasLocalProperty(target,
- isolate->factory()->arguments_string())) {
+ target->HasLocalProperty(isolate->heap()->arguments_string())) {
return target;
}
@@ -14805,7 +14786,8 @@ const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
}
-void Runtime::PerformGC(Object* result, Isolate* isolate) {
+void Runtime::PerformGC(Object* result) {
+ Isolate* isolate = Isolate::Current();
Failure* failure = Failure::cast(result);
if (failure->IsRetryAfterGC()) {
if (isolate->heap()->new_space()->AddFreshPage()) {
« no previous file with comments | « src/runtime.h ('k') | src/stub-cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698