| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/bootstrapper.h" | 5 #include "src/bootstrapper.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/api-natives.h" | 8 #include "src/api-natives.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/extensions/externalize-string-extension.h" | 10 #include "src/extensions/externalize-string-extension.h" |
| (...skipping 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1248 PropertyAttributes attribs = static_cast<PropertyAttributes>( | 1248 PropertyAttributes attribs = static_cast<PropertyAttributes>( |
| 1249 DONT_ENUM | DONT_DELETE | READ_ONLY); | 1249 DONT_ENUM | DONT_DELETE | READ_ONLY); |
| 1250 Handle<AccessorInfo> string_length( | 1250 Handle<AccessorInfo> string_length( |
| 1251 Accessors::StringLengthInfo(isolate, attribs)); | 1251 Accessors::StringLengthInfo(isolate, attribs)); |
| 1252 | 1252 |
| 1253 { // Add length. | 1253 { // Add length. |
| 1254 AccessorConstantDescriptor d(factory->length_string(), string_length, | 1254 AccessorConstantDescriptor d(factory->length_string(), string_length, |
| 1255 attribs); | 1255 attribs); |
| 1256 string_map->AppendDescriptor(&d); | 1256 string_map->AppendDescriptor(&d); |
| 1257 } | 1257 } |
| 1258 | |
| 1259 // Create the %StringPrototype% | |
| 1260 Handle<JSValue> prototype = | |
| 1261 Handle<JSValue>::cast(factory->NewJSObject(string_fun, TENURED)); | |
| 1262 prototype->set_value(isolate->heap()->empty_string()); | |
| 1263 Accessors::FunctionSetPrototype(string_fun, prototype).Assert(); | |
| 1264 | |
| 1265 // Install the "constructor" property on the {prototype}. | |
| 1266 JSObject::AddProperty(prototype, factory->constructor_string(), string_fun, | |
| 1267 DONT_ENUM); | |
| 1268 | |
| 1269 // Install the String.prototype methods. | |
| 1270 SimpleInstallFunction(prototype, "charAt", Builtins::kStringPrototypeCharAt, | |
| 1271 1, true); | |
| 1272 SimpleInstallFunction(prototype, "charCodeAt", | |
| 1273 Builtins::kStringPrototypeCharCodeAt, 1, true); | |
| 1274 } | 1258 } |
| 1275 | 1259 |
| 1276 { | 1260 { |
| 1277 // --- S y m b o l --- | 1261 // --- S y m b o l --- |
| 1278 Handle<JSObject> prototype = | 1262 Handle<JSObject> prototype = |
| 1279 factory->NewJSObject(isolate->object_function(), TENURED); | 1263 factory->NewJSObject(isolate->object_function(), TENURED); |
| 1280 Handle<JSFunction> symbol_fun = | 1264 Handle<JSFunction> symbol_fun = |
| 1281 InstallFunction(global, "Symbol", JS_VALUE_TYPE, JSValue::kSize, | 1265 InstallFunction(global, "Symbol", JS_VALUE_TYPE, JSValue::kSize, |
| 1282 prototype, Builtins::kSymbolConstructor); | 1266 prototype, Builtins::kSymbolConstructor); |
| 1283 symbol_fun->shared()->set_construct_stub( | 1267 symbol_fun->shared()->set_construct_stub( |
| (...skipping 2346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3630 } | 3614 } |
| 3631 | 3615 |
| 3632 | 3616 |
| 3633 // Called when the top-level V8 mutex is destroyed. | 3617 // Called when the top-level V8 mutex is destroyed. |
| 3634 void Bootstrapper::FreeThreadResources() { | 3618 void Bootstrapper::FreeThreadResources() { |
| 3635 DCHECK(!IsActive()); | 3619 DCHECK(!IsActive()); |
| 3636 } | 3620 } |
| 3637 | 3621 |
| 3638 } // namespace internal | 3622 } // namespace internal |
| 3639 } // namespace v8 | 3623 } // namespace v8 |
| OLD | NEW |