OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1517 class V8_EXPORT Primitive : public Value { }; | 1517 class V8_EXPORT Primitive : public Value { }; |
1518 | 1518 |
1519 | 1519 |
1520 /** | 1520 /** |
1521 * A primitive boolean value (ECMA-262, 4.3.14). Either the true | 1521 * A primitive boolean value (ECMA-262, 4.3.14). Either the true |
1522 * or false value. | 1522 * or false value. |
1523 */ | 1523 */ |
1524 class V8_EXPORT Boolean : public Primitive { | 1524 class V8_EXPORT Boolean : public Primitive { |
1525 public: | 1525 public: |
1526 bool Value() const; | 1526 bool Value() const; |
| 1527 V8_INLINE static Handle<Boolean> New(Isolate* isolate, bool value); |
| 1528 // Will be deprecated soon. |
1527 V8_INLINE static Handle<Boolean> New(bool value); | 1529 V8_INLINE static Handle<Boolean> New(bool value); |
1528 }; | 1530 }; |
1529 | 1531 |
1530 | 1532 |
1531 /** | 1533 /** |
1532 * A JavaScript string value (ECMA-262, 4.3.17). | 1534 * A JavaScript string value (ECMA-262, 4.3.17). |
1533 */ | 1535 */ |
1534 class V8_EXPORT String : public Primitive { | 1536 class V8_EXPORT String : public Primitive { |
1535 public: | 1537 public: |
1536 enum Encoding { | 1538 enum Encoding { |
(...skipping 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3087 | 3089 |
3088 | 3090 |
3089 /** | 3091 /** |
3090 * The superclass of object and function templates. | 3092 * The superclass of object and function templates. |
3091 */ | 3093 */ |
3092 class V8_EXPORT Template : public Data { | 3094 class V8_EXPORT Template : public Data { |
3093 public: | 3095 public: |
3094 /** Adds a property to each instance created by this template.*/ | 3096 /** Adds a property to each instance created by this template.*/ |
3095 void Set(Handle<String> name, Handle<Data> value, | 3097 void Set(Handle<String> name, Handle<Data> value, |
3096 PropertyAttribute attributes = None); | 3098 PropertyAttribute attributes = None); |
| 3099 V8_INLINE void Set(Isolate* isolate, const char* name, Handle<Data> value); |
| 3100 // Will be deprecated soon. |
3097 V8_INLINE void Set(const char* name, Handle<Data> value); | 3101 V8_INLINE void Set(const char* name, Handle<Data> value); |
3098 | 3102 |
3099 void SetAccessorProperty( | 3103 void SetAccessorProperty( |
3100 Local<String> name, | 3104 Local<String> name, |
3101 Local<FunctionTemplate> getter = Local<FunctionTemplate>(), | 3105 Local<FunctionTemplate> getter = Local<FunctionTemplate>(), |
3102 Local<FunctionTemplate> setter = Local<FunctionTemplate>(), | 3106 Local<FunctionTemplate> setter = Local<FunctionTemplate>(), |
3103 PropertyAttribute attribute = None, | 3107 PropertyAttribute attribute = None, |
3104 AccessControl settings = DEFAULT); | 3108 AccessControl settings = DEFAULT); |
3105 | 3109 |
3106 /** | 3110 /** |
(...skipping 2917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6024 | 6028 |
6025 Handle<Integer> ScriptOrigin::ResourceColumnOffset() const { | 6029 Handle<Integer> ScriptOrigin::ResourceColumnOffset() const { |
6026 return resource_column_offset_; | 6030 return resource_column_offset_; |
6027 } | 6031 } |
6028 | 6032 |
6029 Handle<Boolean> ScriptOrigin::ResourceIsSharedCrossOrigin() const { | 6033 Handle<Boolean> ScriptOrigin::ResourceIsSharedCrossOrigin() const { |
6030 return resource_is_shared_cross_origin_; | 6034 return resource_is_shared_cross_origin_; |
6031 } | 6035 } |
6032 | 6036 |
6033 | 6037 |
| 6038 Handle<Boolean> Boolean::New(Isolate* isolate, bool value) { |
| 6039 return value ? True(isolate) : False(isolate); |
| 6040 } |
| 6041 |
| 6042 |
6034 Handle<Boolean> Boolean::New(bool value) { | 6043 Handle<Boolean> Boolean::New(bool value) { |
6035 Isolate* isolate = Isolate::GetCurrent(); | 6044 return Boolean::New(Isolate::GetCurrent(), value); |
6036 return value ? True(isolate) : False(isolate); | 6045 } |
| 6046 |
| 6047 |
| 6048 void Template::Set(Isolate* isolate, const char* name, v8::Handle<Data> value) { |
| 6049 Set(v8::String::NewFromUtf8(isolate, name), value); |
6037 } | 6050 } |
6038 | 6051 |
6039 | 6052 |
6040 void Template::Set(const char* name, v8::Handle<Data> value) { | 6053 void Template::Set(const char* name, v8::Handle<Data> value) { |
6041 Set(v8::String::NewFromUtf8(Isolate::GetCurrent(), name), value); | 6054 Set(Isolate::GetCurrent(), name, value); |
6042 } | 6055 } |
6043 | 6056 |
6044 | 6057 |
6045 Local<Value> Object::GetInternalField(int index) { | 6058 Local<Value> Object::GetInternalField(int index) { |
6046 #ifndef V8_ENABLE_CHECKS | 6059 #ifndef V8_ENABLE_CHECKS |
6047 typedef internal::Object O; | 6060 typedef internal::Object O; |
6048 typedef internal::HeapObject HO; | 6061 typedef internal::HeapObject HO; |
6049 typedef internal::Internals I; | 6062 typedef internal::Internals I; |
6050 O* obj = *reinterpret_cast<O**>(this); | 6063 O* obj = *reinterpret_cast<O**>(this); |
6051 // Fast path: If the object is a plain JSObject, which is the common case, we | 6064 // Fast path: If the object is a plain JSObject, which is the common case, we |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6584 */ | 6597 */ |
6585 | 6598 |
6586 | 6599 |
6587 } // namespace v8 | 6600 } // namespace v8 |
6588 | 6601 |
6589 | 6602 |
6590 #undef TYPE_CHECK | 6603 #undef TYPE_CHECK |
6591 | 6604 |
6592 | 6605 |
6593 #endif // V8_H_ | 6606 #endif // V8_H_ |
OLD | NEW |