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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
(...skipping 3165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3176 | 3176 |
3177 // The hole has not been created yet, but we want to put something | 3177 // The hole has not been created yet, but we want to put something |
3178 // predictable in the gaps in the string table, so lets make that Smi zero. | 3178 // predictable in the gaps in the string table, so lets make that Smi zero. |
3179 set_the_hole_value(reinterpret_cast<Oddball*>(Smi::FromInt(0))); | 3179 set_the_hole_value(reinterpret_cast<Oddball*>(Smi::FromInt(0))); |
3180 | 3180 |
3181 // Allocate initial string table. | 3181 // Allocate initial string table. |
3182 set_string_table(*StringTable::New(isolate(), kInitialStringTableSize)); | 3182 set_string_table(*StringTable::New(isolate(), kInitialStringTableSize)); |
3183 | 3183 |
3184 // Finish initializing oddballs after creating the string table. | 3184 // Finish initializing oddballs after creating the string table. |
3185 Oddball::Initialize(isolate(), factory->undefined_value(), "undefined", | 3185 Oddball::Initialize(isolate(), factory->undefined_value(), "undefined", |
3186 factory->nan_value(), Oddball::kUndefined); | 3186 factory->nan_value(), "undefined", Oddball::kUndefined); |
3187 | 3187 |
3188 // Initialize the null_value. | 3188 // Initialize the null_value. |
3189 Oddball::Initialize(isolate(), factory->null_value(), "null", | 3189 Oddball::Initialize(isolate(), factory->null_value(), "null", |
3190 handle(Smi::FromInt(0), isolate()), Oddball::kNull); | 3190 handle(Smi::FromInt(0), isolate()), "object", |
| 3191 Oddball::kNull); |
3191 | 3192 |
3192 set_true_value(*factory->NewOddball(factory->boolean_map(), "true", | 3193 set_true_value(*factory->NewOddball(factory->boolean_map(), "true", |
3193 handle(Smi::FromInt(1), isolate()), | 3194 handle(Smi::FromInt(1), isolate()), |
3194 Oddball::kTrue)); | 3195 "boolean", Oddball::kTrue)); |
3195 | 3196 |
3196 set_false_value(*factory->NewOddball(factory->boolean_map(), "false", | 3197 set_false_value(*factory->NewOddball(factory->boolean_map(), "false", |
3197 handle(Smi::FromInt(0), isolate()), | 3198 handle(Smi::FromInt(0), isolate()), |
3198 Oddball::kFalse)); | 3199 "boolean", Oddball::kFalse)); |
3199 | 3200 |
3200 set_the_hole_value(*factory->NewOddball(factory->the_hole_map(), "hole", | 3201 set_the_hole_value(*factory->NewOddball(factory->the_hole_map(), "hole", |
3201 handle(Smi::FromInt(-1), isolate()), | 3202 handle(Smi::FromInt(-1), isolate()), |
3202 Oddball::kTheHole)); | 3203 "undefined", Oddball::kTheHole)); |
3203 | 3204 |
3204 set_uninitialized_value(*factory->NewOddball( | 3205 set_uninitialized_value( |
3205 factory->uninitialized_map(), "uninitialized", | 3206 *factory->NewOddball(factory->uninitialized_map(), "uninitialized", |
3206 handle(Smi::FromInt(-1), isolate()), Oddball::kUninitialized)); | 3207 handle(Smi::FromInt(-1), isolate()), "undefined", |
| 3208 Oddball::kUninitialized)); |
3207 | 3209 |
3208 set_arguments_marker(*factory->NewOddball( | 3210 set_arguments_marker( |
3209 factory->arguments_marker_map(), "arguments_marker", | 3211 *factory->NewOddball(factory->arguments_marker_map(), "arguments_marker", |
3210 handle(Smi::FromInt(-4), isolate()), Oddball::kArgumentMarker)); | 3212 handle(Smi::FromInt(-4), isolate()), "undefined", |
| 3213 Oddball::kArgumentMarker)); |
3211 | 3214 |
3212 set_no_interceptor_result_sentinel(*factory->NewOddball( | 3215 set_no_interceptor_result_sentinel(*factory->NewOddball( |
3213 factory->no_interceptor_result_sentinel_map(), | 3216 factory->no_interceptor_result_sentinel_map(), |
3214 "no_interceptor_result_sentinel", handle(Smi::FromInt(-2), isolate()), | 3217 "no_interceptor_result_sentinel", handle(Smi::FromInt(-2), isolate()), |
3215 Oddball::kOther)); | 3218 "undefined", Oddball::kOther)); |
3216 | 3219 |
3217 set_termination_exception(*factory->NewOddball( | 3220 set_termination_exception(*factory->NewOddball( |
3218 factory->termination_exception_map(), "termination_exception", | 3221 factory->termination_exception_map(), "termination_exception", |
3219 handle(Smi::FromInt(-3), isolate()), Oddball::kOther)); | 3222 handle(Smi::FromInt(-3), isolate()), "undefined", Oddball::kOther)); |
3220 | 3223 |
3221 set_exception(*factory->NewOddball(factory->exception_map(), "exception", | 3224 set_exception(*factory->NewOddball(factory->exception_map(), "exception", |
3222 handle(Smi::FromInt(-5), isolate()), | 3225 handle(Smi::FromInt(-5), isolate()), |
3223 Oddball::kException)); | 3226 "undefined", Oddball::kException)); |
3224 | 3227 |
3225 for (unsigned i = 0; i < arraysize(constant_string_table); i++) { | 3228 for (unsigned i = 0; i < arraysize(constant_string_table); i++) { |
3226 Handle<String> str = | 3229 Handle<String> str = |
3227 factory->InternalizeUtf8String(constant_string_table[i].contents); | 3230 factory->InternalizeUtf8String(constant_string_table[i].contents); |
3228 roots_[constant_string_table[i].index] = *str; | 3231 roots_[constant_string_table[i].index] = *str; |
3229 } | 3232 } |
3230 | 3233 |
3231 // Allocate the hidden string which is used to identify the hidden properties | 3234 // Allocate the hidden string which is used to identify the hidden properties |
3232 // in JSObjects. The hash code has a special value so that it will not match | 3235 // in JSObjects. The hash code has a special value so that it will not match |
3233 // the empty string when searching for the property. It cannot be part of the | 3236 // the empty string when searching for the property. It cannot be part of the |
(...skipping 3668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6902 *object_type = "CODE_TYPE"; \ | 6905 *object_type = "CODE_TYPE"; \ |
6903 *object_sub_type = "CODE_AGE/" #name; \ | 6906 *object_sub_type = "CODE_AGE/" #name; \ |
6904 return true; | 6907 return true; |
6905 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) | 6908 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) |
6906 #undef COMPARE_AND_RETURN_NAME | 6909 #undef COMPARE_AND_RETURN_NAME |
6907 } | 6910 } |
6908 return false; | 6911 return false; |
6909 } | 6912 } |
6910 } // namespace internal | 6913 } // namespace internal |
6911 } // namespace v8 | 6914 } // namespace v8 |
OLD | NEW |