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

Side by Side Diff: src/builtins.cc

Issue 1394983005: Restructure Object::SetProperty and related functions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase. Created 5 years, 1 month 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
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 "src/builtins.h" 5 #include "src/builtins.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/api-natives.h" 8 #include "src/api-natives.h"
9 #include "src/arguments.h" 9 #include "src/arguments.h"
10 #include "src/base/once.h" 10 #include "src/base/once.h"
(...skipping 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after
1578 Handle<Object> target = args.at<Object>(1); 1578 Handle<Object> target = args.at<Object>(1);
1579 1579
1580 if (!target->IsJSReceiver()) { 1580 if (!target->IsJSReceiver()) {
1581 THROW_NEW_ERROR_RETURN_FAILURE( 1581 THROW_NEW_ERROR_RETURN_FAILURE(
1582 isolate, NewTypeError(MessageTemplate::kCalledOnNonObject, 1582 isolate, NewTypeError(MessageTemplate::kCalledOnNonObject,
1583 isolate->factory()->NewStringFromAsciiChecked( 1583 isolate->factory()->NewStringFromAsciiChecked(
1584 "Reflect.preventExtensions"))); 1584 "Reflect.preventExtensions")));
1585 } 1585 }
1586 1586
1587 Maybe<bool> result = JSReceiver::PreventExtensions( 1587 Maybe<bool> result = JSReceiver::PreventExtensions(
1588 Handle<JSReceiver>::cast(target), DONT_THROW); 1588 Handle<JSReceiver>::cast(target), Object::DONT_THROW);
1589 return result.IsJust() ? *isolate->factory()->ToBoolean(result.FromJust()) 1589 return result.IsJust() ? *isolate->factory()->ToBoolean(result.FromJust())
1590 : isolate->heap()->exception(); 1590 : isolate->heap()->exception();
1591 } 1591 }
1592 1592
1593 1593
1594 // ES6 section 26.1.14 Reflect.setPrototypeOf 1594 // ES6 section 26.1.14 Reflect.setPrototypeOf
1595 BUILTIN(ReflectSetPrototypeOf) { 1595 BUILTIN(ReflectSetPrototypeOf) {
1596 HandleScope scope(isolate); 1596 HandleScope scope(isolate);
1597 DCHECK_EQ(3, args.length()); 1597 DCHECK_EQ(3, args.length());
1598 Handle<Object> target = args.at<Object>(1); 1598 Handle<Object> target = args.at<Object>(1);
1599 Handle<Object> proto = args.at<Object>(2); 1599 Handle<Object> proto = args.at<Object>(2);
1600 1600
1601 if (!target->IsJSReceiver()) { 1601 if (!target->IsJSReceiver()) {
1602 THROW_NEW_ERROR_RETURN_FAILURE( 1602 THROW_NEW_ERROR_RETURN_FAILURE(
1603 isolate, NewTypeError(MessageTemplate::kCalledOnNonObject, 1603 isolate, NewTypeError(MessageTemplate::kCalledOnNonObject,
1604 isolate->factory()->NewStringFromAsciiChecked( 1604 isolate->factory()->NewStringFromAsciiChecked(
1605 "Reflect.setPrototypeOf"))); 1605 "Reflect.setPrototypeOf")));
1606 } 1606 }
1607 1607
1608 if (!proto->IsJSReceiver() && !proto->IsNull()) { 1608 if (!proto->IsJSReceiver() && !proto->IsNull()) {
1609 THROW_NEW_ERROR_RETURN_FAILURE( 1609 THROW_NEW_ERROR_RETURN_FAILURE(
1610 isolate, NewTypeError(MessageTemplate::kProtoObjectOrNull, proto)); 1610 isolate, NewTypeError(MessageTemplate::kProtoObjectOrNull, proto));
1611 } 1611 }
1612 1612
1613 Maybe<bool> result = JSReceiver::SetPrototype( 1613 Maybe<bool> result = JSReceiver::SetPrototype(
1614 Handle<JSReceiver>::cast(target), proto, true, DONT_THROW); 1614 Handle<JSReceiver>::cast(target), proto, true, Object::DONT_THROW);
1615 MAYBE_RETURN(result, isolate->heap()->exception()); 1615 MAYBE_RETURN(result, isolate->heap()->exception());
1616 return *isolate->factory()->ToBoolean(result.FromJust()); 1616 return *isolate->factory()->ToBoolean(result.FromJust());
1617 } 1617 }
1618 1618
1619 1619
1620 // ES6 section 20.3.4.45 Date.prototype [ @@toPrimitive ] ( hint ) 1620 // ES6 section 20.3.4.45 Date.prototype [ @@toPrimitive ] ( hint )
1621 BUILTIN(DateToPrimitive) { 1621 BUILTIN(DateToPrimitive) {
1622 HandleScope scope(isolate); 1622 HandleScope scope(isolate);
1623 DCHECK_EQ(2, args.length()); 1623 DCHECK_EQ(2, args.length());
1624 if (!args.receiver()->IsJSReceiver()) { 1624 if (!args.receiver()->IsJSReceiver()) {
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
2265 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) 2265 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C)
2266 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) 2266 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A)
2267 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) 2267 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H)
2268 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) 2268 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A)
2269 #undef DEFINE_BUILTIN_ACCESSOR_C 2269 #undef DEFINE_BUILTIN_ACCESSOR_C
2270 #undef DEFINE_BUILTIN_ACCESSOR_A 2270 #undef DEFINE_BUILTIN_ACCESSOR_A
2271 2271
2272 2272
2273 } // namespace internal 2273 } // namespace internal
2274 } // namespace v8 2274 } // namespace v8
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | src/objects.h » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698