Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1547 */ | 1547 */ |
| 1548 | 1548 |
| 1549 if (target->IsJSObject()) { | 1549 if (target->IsJSObject()) { |
| 1550 return *isolate->factory()->ToBoolean( | 1550 return *isolate->factory()->ToBoolean( |
| 1551 JSObject::IsExtensible(Handle<JSObject>::cast(target))); | 1551 JSObject::IsExtensible(Handle<JSObject>::cast(target))); |
| 1552 } | 1552 } |
| 1553 return *isolate->factory()->false_value(); | 1553 return *isolate->factory()->false_value(); |
| 1554 } | 1554 } |
| 1555 | 1555 |
| 1556 | 1556 |
| 1557 // ES6 section 26.1.12 Reflect.preventExtensions | |
| 1558 BUILTIN(ReflectPreventExtensions) { | |
| 1559 HandleScope scope(isolate); | |
| 1560 DCHECK_EQ(2, args.length()); | |
| 1561 Handle<Object> target = args.at<Object>(1); | |
| 1562 | |
| 1563 if (!target->IsJSReceiver()) { | |
| 1564 THROW_NEW_ERROR_RETURN_FAILURE( | |
| 1565 isolate, NewTypeError(MessageTemplate::kCalledOnNonObject, | |
| 1566 isolate->factory()->NewStringFromAsciiChecked( | |
| 1567 "Reflect.preventExtensions"))); | |
| 1568 } | |
| 1569 | |
| 1570 // TODO(neis): For now, we ignore proxies. | |
|
rossberg
2015/10/15 10:54:40
Actually, the case distinction should not be made
| |
| 1571 | |
| 1572 if (target->IsJSObject()) { | |
| 1573 bool result; | |
| 1574 MAYBE_ASSIGN_RETURN_ON_EXCEPTION( | |
| 1575 isolate, bool, result, | |
| 1576 JSObject::PreventExtensionsInternal(Handle<JSObject>::cast(target))); | |
| 1577 return *isolate->factory()->ToBoolean(result); | |
| 1578 } | |
| 1579 return *isolate->factory()->false_value(); | |
| 1580 } | |
| 1581 | |
| 1582 | |
| 1557 // ES6 section 20.3.4.45 Date.prototype [ @@toPrimitive ] ( hint ) | 1583 // ES6 section 20.3.4.45 Date.prototype [ @@toPrimitive ] ( hint ) |
| 1558 BUILTIN(DateToPrimitive) { | 1584 BUILTIN(DateToPrimitive) { |
| 1559 HandleScope scope(isolate); | 1585 HandleScope scope(isolate); |
| 1560 DCHECK_EQ(2, args.length()); | 1586 DCHECK_EQ(2, args.length()); |
| 1561 if (!args.receiver()->IsJSReceiver()) { | 1587 if (!args.receiver()->IsJSReceiver()) { |
| 1562 THROW_NEW_ERROR_RETURN_FAILURE( | 1588 THROW_NEW_ERROR_RETURN_FAILURE( |
| 1563 isolate, NewTypeError(MessageTemplate::kIncompatibleMethodReceiver, | 1589 isolate, NewTypeError(MessageTemplate::kIncompatibleMethodReceiver, |
| 1564 isolate->factory()->NewStringFromAsciiChecked( | 1590 isolate->factory()->NewStringFromAsciiChecked( |
| 1565 "Date.prototype [ @@toPrimitive ]"), | 1591 "Date.prototype [ @@toPrimitive ]"), |
| 1566 args.receiver())); | 1592 args.receiver())); |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2199 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 2225 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
| 2200 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 2226 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 2201 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 2227 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
| 2202 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 2228 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 2203 #undef DEFINE_BUILTIN_ACCESSOR_C | 2229 #undef DEFINE_BUILTIN_ACCESSOR_C |
| 2204 #undef DEFINE_BUILTIN_ACCESSOR_A | 2230 #undef DEFINE_BUILTIN_ACCESSOR_A |
| 2205 | 2231 |
| 2206 | 2232 |
| 2207 } // namespace internal | 2233 } // namespace internal |
| 2208 } // namespace v8 | 2234 } // namespace v8 |
| OLD | NEW |