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 #ifndef V8_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1023 // a keyed store is of the form a[expression] = foo. | 1023 // a keyed store is of the form a[expression] = foo. |
1024 enum StoreFromKeyed { | 1024 enum StoreFromKeyed { |
1025 MAY_BE_STORE_FROM_KEYED, | 1025 MAY_BE_STORE_FROM_KEYED, |
1026 CERTAINLY_NOT_STORE_FROM_KEYED | 1026 CERTAINLY_NOT_STORE_FROM_KEYED |
1027 }; | 1027 }; |
1028 | 1028 |
1029 enum ShouldThrow { THROW_ON_ERROR, DONT_THROW }; | 1029 enum ShouldThrow { THROW_ON_ERROR, DONT_THROW }; |
1030 | 1030 |
1031 #define RETURN_FAILURE(isolate, should_throw, call) \ | 1031 #define RETURN_FAILURE(isolate, should_throw, call) \ |
1032 do { \ | 1032 do { \ |
1033 if ((should_throw) == DONT_THROW) { \ | 1033 if ((should_throw) == Object::DONT_THROW) { \ |
1034 return Just(false); \ | 1034 return Just(false); \ |
1035 } else { \ | 1035 } else { \ |
1036 isolate->Throw(*isolate->factory()->call); \ | 1036 isolate->Throw(*isolate->factory()->call); \ |
1037 return Nothing<bool>(); \ | 1037 return Nothing<bool>(); \ |
1038 } \ | 1038 } \ |
1039 } while (false) | 1039 } while (false) |
1040 | 1040 |
1041 #define MAYBE_RETURN(call, value) \ | 1041 #define MAYBE_RETURN(call, value) \ |
1042 do { \ | 1042 do { \ |
1043 if ((call).IsNothing()) return value; \ | 1043 if ((call).IsNothing()) return value; \ |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1165 // ES6 section 7.1.12 ToString | 1165 // ES6 section 7.1.12 ToString |
1166 MUST_USE_RESULT static MaybeHandle<String> ToString(Isolate* isolate, | 1166 MUST_USE_RESULT static MaybeHandle<String> ToString(Isolate* isolate, |
1167 Handle<Object> input); | 1167 Handle<Object> input); |
1168 | 1168 |
1169 // ES6 section 7.1.15 ToLength | 1169 // ES6 section 7.1.15 ToLength |
1170 MUST_USE_RESULT static MaybeHandle<Object> ToLength(Isolate* isolate, | 1170 MUST_USE_RESULT static MaybeHandle<Object> ToLength(Isolate* isolate, |
1171 Handle<Object> input); | 1171 Handle<Object> input); |
1172 | 1172 |
1173 // ES6 section 7.3.9 GetMethod | 1173 // ES6 section 7.3.9 GetMethod |
1174 MUST_USE_RESULT static MaybeHandle<Object> GetMethod( | 1174 MUST_USE_RESULT static MaybeHandle<Object> GetMethod( |
1175 Handle<JSReceiver> receiver, Handle<Name> name); | 1175 Handle<JSReceiver> receiver, Handle<Name> name, |
| 1176 ShouldThrow should_throw = THROW_ON_ERROR); |
1176 | 1177 |
1177 // ES6 section 12.5.6 The typeof Operator | 1178 // ES6 section 12.5.6 The typeof Operator |
1178 static Handle<String> TypeOf(Isolate* isolate, Handle<Object> object); | 1179 static Handle<String> TypeOf(Isolate* isolate, Handle<Object> object); |
1179 | 1180 |
1180 // ES6 section 12.6 Multiplicative Operators | 1181 // ES6 section 12.6 Multiplicative Operators |
1181 MUST_USE_RESULT static MaybeHandle<Object> Multiply( | 1182 MUST_USE_RESULT static MaybeHandle<Object> Multiply( |
1182 Isolate* isolate, Handle<Object> lhs, Handle<Object> rhs, | 1183 Isolate* isolate, Handle<Object> lhs, Handle<Object> rhs, |
1183 Strength strength = Strength::WEAK); | 1184 Strength strength = Strength::WEAK); |
1184 MUST_USE_RESULT static MaybeHandle<Object> Divide( | 1185 MUST_USE_RESULT static MaybeHandle<Object> Divide( |
1185 Isolate* isolate, Handle<Object> lhs, Handle<Object> rhs, | 1186 Isolate* isolate, Handle<Object> lhs, Handle<Object> rhs, |
(...skipping 8385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9571 DECL_ACCESSORS(handler, Object) | 9572 DECL_ACCESSORS(handler, Object) |
9572 // [target]: The target property. | 9573 // [target]: The target property. |
9573 DECL_ACCESSORS(target, Object) | 9574 DECL_ACCESSORS(target, Object) |
9574 // [hash]: The hash code property (undefined if not initialized yet). | 9575 // [hash]: The hash code property (undefined if not initialized yet). |
9575 DECL_ACCESSORS(hash, Object) | 9576 DECL_ACCESSORS(hash, Object) |
9576 | 9577 |
9577 inline bool has_handler(); | 9578 inline bool has_handler(); |
9578 | 9579 |
9579 DECLARE_CAST(JSProxy) | 9580 DECLARE_CAST(JSProxy) |
9580 | 9581 |
9581 static MaybeHandle<Object> GetPrototype(Handle<JSProxy> receiver); | 9582 // Proxy Traps: |
| 9583 static MaybeHandle<Object> GetPrototype(Handle<JSProxy> proxy); |
| 9584 static Maybe<bool> SetPrototype(Handle<JSProxy> proxy, Handle<Object> value, |
| 9585 bool from_javascript, |
| 9586 ShouldThrow should_throw); |
9582 | 9587 |
9583 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithHandler( | 9588 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithHandler( |
9584 Handle<JSProxy> proxy, | 9589 Handle<JSProxy> proxy, |
9585 Handle<Object> receiver, | 9590 Handle<Object> receiver, |
9586 Handle<Name> name); | 9591 Handle<Name> name); |
9587 | 9592 |
9588 // If the handler defines an accessor property with a setter, invoke it. | 9593 // If the handler defines an accessor property with a setter, invoke it. |
9589 // If it defines an accessor property without a setter, or a data property | 9594 // If it defines an accessor property without a setter, or a data property |
9590 // that is read-only, fail. In all these cases set '*done' to true. | 9595 // that is read-only, fail. In all these cases set '*done' to true. |
9591 // Otherwise set it to false, in which case the return value is not | 9596 // Otherwise set it to false, in which case the return value is not |
(...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10774 } | 10779 } |
10775 return value; | 10780 return value; |
10776 } | 10781 } |
10777 }; | 10782 }; |
10778 | 10783 |
10779 | 10784 |
10780 } // NOLINT, false-positive due to second-order macros. | 10785 } // NOLINT, false-positive due to second-order macros. |
10781 } // NOLINT, false-positive due to second-order macros. | 10786 } // NOLINT, false-positive due to second-order macros. |
10782 | 10787 |
10783 #endif // V8_OBJECTS_H_ | 10788 #endif // V8_OBJECTS_H_ |
OLD | NEW |