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

Side by Side Diff: src/runtime/runtime.cc

Issue 593073002: Stores and compound assignments for named super properties. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased for landing Created 6 years, 2 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdlib.h> 5 #include <stdlib.h>
6 #include <limits> 6 #include <limits>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 1936 matching lines...) Expand 10 before | Expand all | Expand 10 after
1947 1947
1948 RUNTIME_FUNCTION(Runtime_HomeObjectSymbol) { 1948 RUNTIME_FUNCTION(Runtime_HomeObjectSymbol) {
1949 DCHECK(args.length() == 0); 1949 DCHECK(args.length() == 0);
1950 return isolate->heap()->home_object_symbol(); 1950 return isolate->heap()->home_object_symbol();
1951 } 1951 }
1952 1952
1953 1953
1954 RUNTIME_FUNCTION(Runtime_LoadFromSuper) { 1954 RUNTIME_FUNCTION(Runtime_LoadFromSuper) {
1955 HandleScope scope(isolate); 1955 HandleScope scope(isolate);
1956 DCHECK(args.length() == 3); 1956 DCHECK(args.length() == 3);
1957 CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 0); 1957 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0);
1958 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 1); 1958 CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1);
1959 CONVERT_ARG_HANDLE_CHECKED(Name, name, 2); 1959 CONVERT_ARG_HANDLE_CHECKED(Name, name, 2);
1960 1960
1961 if (home_object->IsAccessCheckNeeded() && 1961 if (home_object->IsAccessCheckNeeded() &&
1962 !isolate->MayNamedAccess(home_object, name, v8::ACCESS_GET)) { 1962 !isolate->MayNamedAccess(home_object, name, v8::ACCESS_GET)) {
1963 isolate->ReportFailedAccessCheck(home_object, v8::ACCESS_GET); 1963 isolate->ReportFailedAccessCheck(home_object, v8::ACCESS_GET);
1964 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); 1964 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
1965 } 1965 }
1966 1966
1967 PrototypeIterator iter(isolate, home_object); 1967 PrototypeIterator iter(isolate, home_object);
1968 Handle<Object> proto = PrototypeIterator::GetCurrent(iter); 1968 Handle<Object> proto = PrototypeIterator::GetCurrent(iter);
1969 if (!proto->IsJSReceiver()) return isolate->heap()->undefined_value(); 1969 if (!proto->IsJSReceiver()) return isolate->heap()->undefined_value();
1970 1970
1971 LookupIterator it(receiver, name, Handle<JSReceiver>::cast(proto)); 1971 LookupIterator it(receiver, name, Handle<JSReceiver>::cast(proto));
1972 Handle<Object> result; 1972 Handle<Object> result;
1973 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, Object::GetProperty(&it)); 1973 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, Object::GetProperty(&it));
1974 return *result; 1974 return *result;
1975 } 1975 }
1976 1976
1977 1977
1978 static Object* StoreToSuper(Isolate* isolate, Handle<JSObject> home_object,
1979 Handle<Object> receiver, Handle<Name> name,
1980 Handle<Object> value, StrictMode strict_mode) {
1981 if (home_object->IsAccessCheckNeeded() &&
1982 !isolate->MayNamedAccess(home_object, name, v8::ACCESS_SET)) {
1983 isolate->ReportFailedAccessCheck(home_object, v8::ACCESS_SET);
1984 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
1985 }
1986
1987 PrototypeIterator iter(isolate, home_object);
1988 Handle<Object> proto = PrototypeIterator::GetCurrent(iter);
1989 if (!proto->IsJSReceiver()) return isolate->heap()->undefined_value();
1990
1991 LookupIterator it(receiver, name, Handle<JSReceiver>::cast(proto));
1992 Handle<Object> result;
1993 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
1994 isolate, result,
1995 Object::SetProperty(&it, value, strict_mode,
1996 Object::CERTAINLY_NOT_STORE_FROM_KEYED,
1997 Object::SUPER_PROPERTY));
1998 return *result;
1999 }
2000
2001
2002 RUNTIME_FUNCTION(Runtime_StoreToSuper_Strict) {
2003 HandleScope scope(isolate);
2004 DCHECK(args.length() == 4);
2005 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0);
2006 CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1);
2007 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
2008 CONVERT_ARG_HANDLE_CHECKED(Name, name, 3);
2009
2010 return StoreToSuper(isolate, home_object, receiver, name, value, STRICT);
2011 }
2012
2013
2014 RUNTIME_FUNCTION(Runtime_StoreToSuper_Sloppy) {
arv (Not doing code reviews) 2014/09/29 14:37:27 Why not take strict mode as a parameter?
2015 HandleScope scope(isolate);
2016 DCHECK(args.length() == 4);
2017 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0);
2018 CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1);
2019 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
2020 CONVERT_ARG_HANDLE_CHECKED(Name, name, 3);
2021
2022 return StoreToSuper(isolate, home_object, receiver, name, value, SLOPPY);
2023 }
2024
2025
1978 RUNTIME_FUNCTION(Runtime_IsExtensible) { 2026 RUNTIME_FUNCTION(Runtime_IsExtensible) {
1979 SealHandleScope shs(isolate); 2027 SealHandleScope shs(isolate);
1980 DCHECK(args.length() == 1); 2028 DCHECK(args.length() == 1);
1981 CONVERT_ARG_CHECKED(JSObject, obj, 0); 2029 CONVERT_ARG_CHECKED(JSObject, obj, 0);
1982 if (obj->IsJSGlobalProxy()) { 2030 if (obj->IsJSGlobalProxy()) {
1983 PrototypeIterator iter(isolate, obj); 2031 PrototypeIterator iter(isolate, obj);
1984 if (iter.IsAtEnd()) return isolate->heap()->false_value(); 2032 if (iter.IsAtEnd()) return isolate->heap()->false_value();
1985 DCHECK(iter.GetCurrent()->IsJSGlobalObject()); 2033 DCHECK(iter.GetCurrent()->IsJSGlobalObject());
1986 obj = JSObject::cast(iter.GetCurrent()); 2034 obj = JSObject::cast(iter.GetCurrent());
1987 } 2035 }
(...skipping 12584 matching lines...) Expand 10 before | Expand all | Expand 10 after
14572 } 14620 }
14573 return NULL; 14621 return NULL;
14574 } 14622 }
14575 14623
14576 14624
14577 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { 14625 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
14578 return &(kIntrinsicFunctions[static_cast<int>(id)]); 14626 return &(kIntrinsicFunctions[static_cast<int>(id)]);
14579 } 14627 }
14580 } 14628 }
14581 } // namespace v8::internal 14629 } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698