OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 Context* native_context = isolate->context()->native_context(); | 91 Context* native_context = isolate->context()->native_context(); |
92 return CreateJSValue(native_context->number_function(), this); | 92 return CreateJSValue(native_context->number_function(), this); |
93 } else if (IsBoolean()) { | 93 } else if (IsBoolean()) { |
94 Isolate* isolate = HeapObject::cast(this)->GetIsolate(); | 94 Isolate* isolate = HeapObject::cast(this)->GetIsolate(); |
95 Context* native_context = isolate->context()->native_context(); | 95 Context* native_context = isolate->context()->native_context(); |
96 return CreateJSValue(native_context->boolean_function(), this); | 96 return CreateJSValue(native_context->boolean_function(), this); |
97 } else if (IsString()) { | 97 } else if (IsString()) { |
98 Isolate* isolate = HeapObject::cast(this)->GetIsolate(); | 98 Isolate* isolate = HeapObject::cast(this)->GetIsolate(); |
99 Context* native_context = isolate->context()->native_context(); | 99 Context* native_context = isolate->context()->native_context(); |
100 return CreateJSValue(native_context->string_function(), this); | 100 return CreateJSValue(native_context->string_function(), this); |
| 101 } else if (IsSymbol()) { |
| 102 Isolate* isolate = HeapObject::cast(this)->GetIsolate(); |
| 103 Context* native_context = isolate->context()->native_context(); |
| 104 return CreateJSValue(native_context->symbol_function(), this); |
101 } | 105 } |
102 | 106 |
103 // Throw a type error. | 107 // Throw a type error. |
104 return Failure::InternalError(); | 108 return Failure::InternalError(); |
105 } | 109 } |
106 | 110 |
107 | 111 |
108 bool Object::BooleanValue() { | 112 bool Object::BooleanValue() { |
109 if (IsBoolean()) return IsTrue(); | 113 if (IsBoolean()) return IsTrue(); |
110 if (IsSmi()) return Smi::cast(this)->value() != 0; | 114 if (IsSmi()) return Smi::cast(this)->value() != 0; |
(...skipping 14245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14356 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 14360 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
14357 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 14361 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
14358 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 14362 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
14359 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 14363 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
14360 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 14364 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
14361 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 14365 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
14362 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 14366 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
14363 } | 14367 } |
14364 | 14368 |
14365 } } // namespace v8::internal | 14369 } } // namespace v8::internal |
OLD | NEW |