Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: src/bootstrapper.cc

Issue 2080243003: Use instance type in Object.prototype.toString(). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add TODO comment about checking IsArray() before reading toStringTag. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/deoptimizer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/base/ieee754.h" 9 #include "src/base/ieee754.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after
1578 1578
1579 static const int num_fields = JSRegExp::kInObjectFieldCount; 1579 static const int num_fields = JSRegExp::kInObjectFieldCount;
1580 initial_map->SetInObjectProperties(num_fields); 1580 initial_map->SetInObjectProperties(num_fields);
1581 initial_map->set_unused_property_fields(0); 1581 initial_map->set_unused_property_fields(0);
1582 initial_map->set_instance_size(initial_map->instance_size() + 1582 initial_map->set_instance_size(initial_map->instance_size() +
1583 num_fields * kPointerSize); 1583 num_fields * kPointerSize);
1584 } 1584 }
1585 1585
1586 { // -- E r r o r 1586 { // -- E r r o r
1587 Handle<JSFunction> error_fun = InstallFunction( 1587 Handle<JSFunction> error_fun = InstallFunction(
1588 global, "Error", JS_OBJECT_TYPE, JSObject::kHeaderSize, 1588 global, "Error", JS_ERROR_TYPE, JSObject::kHeaderSize,
1589 isolate->initial_object_prototype(), Builtins::kIllegal); 1589 isolate->initial_object_prototype(), Builtins::kIllegal);
1590 InstallWithIntrinsicDefaultProto(isolate, error_fun, 1590 InstallWithIntrinsicDefaultProto(isolate, error_fun,
1591 Context::ERROR_FUNCTION_INDEX); 1591 Context::ERROR_FUNCTION_INDEX);
1592 } 1592 }
1593 1593
1594 { // -- E v a l E r r o r 1594 { // -- E v a l E r r o r
1595 Handle<JSFunction> eval_error_fun = InstallFunction( 1595 Handle<JSFunction> eval_error_fun = InstallFunction(
1596 global, "EvalError", JS_OBJECT_TYPE, JSObject::kHeaderSize, 1596 global, "EvalError", JS_ERROR_TYPE, JSObject::kHeaderSize,
1597 isolate->initial_object_prototype(), Builtins::kIllegal); 1597 isolate->initial_object_prototype(), Builtins::kIllegal);
1598 InstallWithIntrinsicDefaultProto(isolate, eval_error_fun, 1598 InstallWithIntrinsicDefaultProto(isolate, eval_error_fun,
1599 Context::EVAL_ERROR_FUNCTION_INDEX); 1599 Context::EVAL_ERROR_FUNCTION_INDEX);
1600 } 1600 }
1601 1601
1602 { // -- R a n g e E r r o r 1602 { // -- R a n g e E r r o r
1603 Handle<JSFunction> range_error_fun = InstallFunction( 1603 Handle<JSFunction> range_error_fun = InstallFunction(
1604 global, "RangeError", JS_OBJECT_TYPE, JSObject::kHeaderSize, 1604 global, "RangeError", JS_ERROR_TYPE, JSObject::kHeaderSize,
1605 isolate->initial_object_prototype(), Builtins::kIllegal); 1605 isolate->initial_object_prototype(), Builtins::kIllegal);
1606 InstallWithIntrinsicDefaultProto(isolate, range_error_fun, 1606 InstallWithIntrinsicDefaultProto(isolate, range_error_fun,
1607 Context::RANGE_ERROR_FUNCTION_INDEX); 1607 Context::RANGE_ERROR_FUNCTION_INDEX);
1608 } 1608 }
1609 1609
1610 { // -- R e f e r e n c e E r r o r 1610 { // -- R e f e r e n c e E r r o r
1611 Handle<JSFunction> reference_error_fun = InstallFunction( 1611 Handle<JSFunction> reference_error_fun = InstallFunction(
1612 global, "ReferenceError", JS_OBJECT_TYPE, JSObject::kHeaderSize, 1612 global, "ReferenceError", JS_ERROR_TYPE, JSObject::kHeaderSize,
1613 isolate->initial_object_prototype(), Builtins::kIllegal); 1613 isolate->initial_object_prototype(), Builtins::kIllegal);
1614 InstallWithIntrinsicDefaultProto(isolate, reference_error_fun, 1614 InstallWithIntrinsicDefaultProto(isolate, reference_error_fun,
1615 Context::REFERENCE_ERROR_FUNCTION_INDEX); 1615 Context::REFERENCE_ERROR_FUNCTION_INDEX);
1616 } 1616 }
1617 1617
1618 { // -- S y n t a x E r r o r 1618 { // -- S y n t a x E r r o r
1619 Handle<JSFunction> syntax_error_fun = InstallFunction( 1619 Handle<JSFunction> syntax_error_fun = InstallFunction(
1620 global, "SyntaxError", JS_OBJECT_TYPE, JSObject::kHeaderSize, 1620 global, "SyntaxError", JS_ERROR_TYPE, JSObject::kHeaderSize,
1621 isolate->initial_object_prototype(), Builtins::kIllegal); 1621 isolate->initial_object_prototype(), Builtins::kIllegal);
1622 InstallWithIntrinsicDefaultProto(isolate, syntax_error_fun, 1622 InstallWithIntrinsicDefaultProto(isolate, syntax_error_fun,
1623 Context::SYNTAX_ERROR_FUNCTION_INDEX); 1623 Context::SYNTAX_ERROR_FUNCTION_INDEX);
1624 } 1624 }
1625 1625
1626 { // -- T y p e E r r o r 1626 { // -- T y p e E r r o r
1627 Handle<JSFunction> type_error_fun = InstallFunction( 1627 Handle<JSFunction> type_error_fun = InstallFunction(
1628 global, "TypeError", JS_OBJECT_TYPE, JSObject::kHeaderSize, 1628 global, "TypeError", JS_ERROR_TYPE, JSObject::kHeaderSize,
1629 isolate->initial_object_prototype(), Builtins::kIllegal); 1629 isolate->initial_object_prototype(), Builtins::kIllegal);
1630 InstallWithIntrinsicDefaultProto(isolate, type_error_fun, 1630 InstallWithIntrinsicDefaultProto(isolate, type_error_fun,
1631 Context::TYPE_ERROR_FUNCTION_INDEX); 1631 Context::TYPE_ERROR_FUNCTION_INDEX);
1632 } 1632 }
1633 1633
1634 { // -- U R I E r r o r 1634 { // -- U R I E r r o r
1635 Handle<JSFunction> uri_error_fun = InstallFunction( 1635 Handle<JSFunction> uri_error_fun = InstallFunction(
1636 global, "URIError", JS_OBJECT_TYPE, JSObject::kHeaderSize, 1636 global, "URIError", JS_ERROR_TYPE, JSObject::kHeaderSize,
1637 isolate->initial_object_prototype(), Builtins::kIllegal); 1637 isolate->initial_object_prototype(), Builtins::kIllegal);
1638 InstallWithIntrinsicDefaultProto(isolate, uri_error_fun, 1638 InstallWithIntrinsicDefaultProto(isolate, uri_error_fun,
1639 Context::URI_ERROR_FUNCTION_INDEX); 1639 Context::URI_ERROR_FUNCTION_INDEX);
1640 } 1640 }
1641 1641
1642 // Initialize the embedder data slot. 1642 // Initialize the embedder data slot.
1643 Handle<FixedArray> embedder_data = factory->NewFixedArray(3); 1643 Handle<FixedArray> embedder_data = factory->NewFixedArray(3);
1644 native_context()->set_embedder_data(*embedder_data); 1644 native_context()->set_embedder_data(*embedder_data);
1645 1645
1646 if (context_type == THIN_CONTEXT) return; 1646 if (context_type == THIN_CONTEXT) return;
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
1973 // Make sure we can recognize argument objects at runtime. 1973 // Make sure we can recognize argument objects at runtime.
1974 // This is done by introducing an anonymous function with 1974 // This is done by introducing an anonymous function with
1975 // class_name equals 'Arguments'. 1975 // class_name equals 'Arguments'.
1976 Handle<String> arguments_string = factory->Arguments_string(); 1976 Handle<String> arguments_string = factory->Arguments_string();
1977 Handle<Code> code = isolate->builtins()->Illegal(); 1977 Handle<Code> code = isolate->builtins()->Illegal();
1978 Handle<JSFunction> function = factory->NewFunctionWithoutPrototype( 1978 Handle<JSFunction> function = factory->NewFunctionWithoutPrototype(
1979 arguments_string, code); 1979 arguments_string, code);
1980 function->shared()->set_instance_class_name(*arguments_string); 1980 function->shared()->set_instance_class_name(*arguments_string);
1981 1981
1982 Handle<Map> map = factory->NewMap( 1982 Handle<Map> map = factory->NewMap(
1983 JS_OBJECT_TYPE, JSSloppyArgumentsObject::kSize, FAST_ELEMENTS); 1983 JS_ARGUMENTS_TYPE, JSSloppyArgumentsObject::kSize, FAST_ELEMENTS);
1984 // Create the descriptor array for the arguments object. 1984 // Create the descriptor array for the arguments object.
1985 Map::EnsureDescriptorSlack(map, 2); 1985 Map::EnsureDescriptorSlack(map, 2);
1986 1986
1987 { // length 1987 { // length
1988 DataDescriptor d(factory->length_string(), 1988 DataDescriptor d(factory->length_string(),
1989 JSSloppyArgumentsObject::kLengthIndex, DONT_ENUM, 1989 JSSloppyArgumentsObject::kLengthIndex, DONT_ENUM,
1990 Representation::Tagged()); 1990 Representation::Tagged());
1991 map->AppendDescriptor(&d); 1991 map->AppendDescriptor(&d);
1992 } 1992 }
1993 { // callee 1993 { // callee
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
2033 Handle<JSFunction> poison = GetStrictArgumentsPoisonFunction(); 2033 Handle<JSFunction> poison = GetStrictArgumentsPoisonFunction();
2034 2034
2035 // Install the ThrowTypeError functions. 2035 // Install the ThrowTypeError functions.
2036 callee->set_getter(*poison); 2036 callee->set_getter(*poison);
2037 callee->set_setter(*poison); 2037 callee->set_setter(*poison);
2038 caller->set_getter(*poison); 2038 caller->set_getter(*poison);
2039 caller->set_setter(*poison); 2039 caller->set_setter(*poison);
2040 2040
2041 // Create the map. Allocate one in-object field for length. 2041 // Create the map. Allocate one in-object field for length.
2042 Handle<Map> map = factory->NewMap( 2042 Handle<Map> map = factory->NewMap(
2043 JS_OBJECT_TYPE, JSStrictArgumentsObject::kSize, FAST_ELEMENTS); 2043 JS_ARGUMENTS_TYPE, JSStrictArgumentsObject::kSize, FAST_ELEMENTS);
2044 // Create the descriptor array for the arguments object. 2044 // Create the descriptor array for the arguments object.
2045 Map::EnsureDescriptorSlack(map, 3); 2045 Map::EnsureDescriptorSlack(map, 3);
2046 2046
2047 { // length 2047 { // length
2048 DataDescriptor d(factory->length_string(), 2048 DataDescriptor d(factory->length_string(),
2049 JSStrictArgumentsObject::kLengthIndex, DONT_ENUM, 2049 JSStrictArgumentsObject::kLengthIndex, DONT_ENUM,
2050 Representation::Tagged()); 2050 Representation::Tagged());
2051 map->AppendDescriptor(&d); 2051 map->AppendDescriptor(&d);
2052 } 2052 }
2053 { // callee 2053 { // callee
(...skipping 1925 matching lines...) Expand 10 before | Expand all | Expand 10 after
3979 } 3979 }
3980 3980
3981 3981
3982 // Called when the top-level V8 mutex is destroyed. 3982 // Called when the top-level V8 mutex is destroyed.
3983 void Bootstrapper::FreeThreadResources() { 3983 void Bootstrapper::FreeThreadResources() {
3984 DCHECK(!IsActive()); 3984 DCHECK(!IsActive());
3985 } 3985 }
3986 3986
3987 } // namespace internal 3987 } // namespace internal
3988 } // namespace v8 3988 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/deoptimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698