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

Side by Side Diff: src/bootstrapper.cc

Issue 1949863002: Fix TypedArray Property optimizations (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Use CreateFunction Created 4 years, 7 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
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/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 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after
1598 } 1598 }
1599 1599
1600 { // -- A r r a y B u f f e r 1600 { // -- A r r a y B u f f e r
1601 Handle<JSFunction> array_buffer_fun = 1601 Handle<JSFunction> array_buffer_fun =
1602 InstallArrayBuffer(global, "ArrayBuffer"); 1602 InstallArrayBuffer(global, "ArrayBuffer");
1603 InstallWithIntrinsicDefaultProto(isolate, array_buffer_fun, 1603 InstallWithIntrinsicDefaultProto(isolate, array_buffer_fun,
1604 Context::ARRAY_BUFFER_FUN_INDEX); 1604 Context::ARRAY_BUFFER_FUN_INDEX);
1605 } 1605 }
1606 1606
1607 { // -- T y p e d A r r a y s 1607 { // -- T y p e d A r r a y s
1608 // Create the %TypedArrayPrototype%
1609 Handle<JSObject> typed_array_prototype =
1610 factory->NewJSObject(isolate->object_function(), TENURED);
1611 native_context()->set_typed_array_prototype(*typed_array_prototype);
1612
1613 Handle<JSFunction> typed_array_fun = CreateFunction(
1614 isolate, factory->InternalizeUtf8String("TypedArray"), JS_OBJECT_TYPE,
1615 JSObject::kHeaderSize, typed_array_prototype, Builtins::kIllegal);
1616 InstallWithIntrinsicDefaultProto(isolate, typed_array_fun,
1617 Context::TYPED_ARRAY_FUN_INDEX);
1618
1608 #define INSTALL_TYPED_ARRAY(Type, type, TYPE, ctype, size) \ 1619 #define INSTALL_TYPED_ARRAY(Type, type, TYPE, ctype, size) \
1609 { \ 1620 { \
1610 Handle<JSFunction> fun; \ 1621 Handle<JSFunction> fun; \
1611 InstallTypedArray(#Type "Array", TYPE##_ELEMENTS, &fun); \ 1622 InstallTypedArray(#Type "Array", TYPE##_ELEMENTS, &fun); \
1612 InstallWithIntrinsicDefaultProto(isolate, fun, \ 1623 InstallWithIntrinsicDefaultProto(isolate, fun, \
1613 Context::TYPE##_ARRAY_FUN_INDEX); \ 1624 Context::TYPE##_ARRAY_FUN_INDEX); \
1614 } 1625 }
1615 TYPED_ARRAYS(INSTALL_TYPED_ARRAY) 1626 TYPED_ARRAYS(INSTALL_TYPED_ARRAY)
1616 #undef INSTALL_TYPED_ARRAY 1627 #undef INSTALL_TYPED_ARRAY
1617 1628
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
1920 factory->empty_string(), code, JS_OBJECT_TYPE, JSObject::kHeaderSize); 1931 factory->empty_string(), code, JS_OBJECT_TYPE, JSObject::kHeaderSize);
1921 native_context()->set_call_as_constructor_delegate(*delegate); 1932 native_context()->set_call_as_constructor_delegate(*delegate);
1922 delegate->shared()->DontAdaptArguments(); 1933 delegate->shared()->DontAdaptArguments();
1923 } 1934 }
1924 } // NOLINT(readability/fn_size) 1935 } // NOLINT(readability/fn_size)
1925 1936
1926 1937
1927 void Genesis::InstallTypedArray(const char* name, ElementsKind elements_kind, 1938 void Genesis::InstallTypedArray(const char* name, ElementsKind elements_kind,
1928 Handle<JSFunction>* fun) { 1939 Handle<JSFunction>* fun) {
1929 Handle<JSObject> global = Handle<JSObject>(native_context()->global_object()); 1940 Handle<JSObject> global = Handle<JSObject>(native_context()->global_object());
1930 Handle<JSFunction> result = InstallFunction( 1941
1931 global, name, JS_TYPED_ARRAY_TYPE, JSTypedArray::kSize, 1942 Handle<JSObject> typed_array_prototype =
1932 isolate()->initial_object_prototype(), Builtins::kIllegal); 1943 Handle<JSObject>(isolate()->typed_array_prototype());
1944 Handle<JSFunction> typed_array_function =
1945 Handle<JSFunction>(isolate()->typed_array_function());
1946
1947 Handle<JSObject> prototype =
1948 factory()->NewJSObject(isolate()->object_function(), TENURED);
1949 Handle<JSFunction> result =
1950 InstallFunction(global, name, JS_TYPED_ARRAY_TYPE, JSTypedArray::kSize,
1951 prototype, Builtins::kIllegal);
1933 1952
1934 Handle<Map> initial_map = isolate()->factory()->NewMap( 1953 Handle<Map> initial_map = isolate()->factory()->NewMap(
1935 JS_TYPED_ARRAY_TYPE, 1954 JS_TYPED_ARRAY_TYPE,
1936 JSTypedArray::kSizeWithInternalFields, 1955 JSTypedArray::kSizeWithInternalFields,
1937 elements_kind); 1956 elements_kind);
1938 JSFunction::SetInitialMap(result, initial_map, 1957 JSFunction::SetInitialMap(result, initial_map,
1939 handle(initial_map->prototype(), isolate())); 1958 handle(initial_map->prototype(), isolate()));
1959
1960 CHECK(JSObject::SetPrototype(result, typed_array_function, false,
1961 Object::DONT_THROW)
1962 .FromJust());
1963
1964 CHECK(JSObject::SetPrototype(prototype, typed_array_prototype, false,
1965 Object::DONT_THROW)
1966 .FromJust());
1967
1940 *fun = result; 1968 *fun = result;
1941 } 1969 }
1942 1970
1943 1971
1944 void Genesis::InitializeExperimentalGlobal() { 1972 void Genesis::InitializeExperimentalGlobal() {
1945 #define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id(); 1973 #define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id();
1946 1974
1947 HARMONY_INPROGRESS(FEATURE_INITIALIZE_GLOBAL) 1975 HARMONY_INPROGRESS(FEATURE_INITIALIZE_GLOBAL)
1948 HARMONY_STAGED(FEATURE_INITIALIZE_GLOBAL) 1976 HARMONY_STAGED(FEATURE_INITIALIZE_GLOBAL)
1949 HARMONY_SHIPPING(FEATURE_INITIALIZE_GLOBAL) 1977 HARMONY_SHIPPING(FEATURE_INITIALIZE_GLOBAL)
(...skipping 1737 matching lines...) Expand 10 before | Expand all | Expand 10 after
3687 } 3715 }
3688 3716
3689 3717
3690 // Called when the top-level V8 mutex is destroyed. 3718 // Called when the top-level V8 mutex is destroyed.
3691 void Bootstrapper::FreeThreadResources() { 3719 void Bootstrapper::FreeThreadResources() {
3692 DCHECK(!IsActive()); 3720 DCHECK(!IsActive());
3693 } 3721 }
3694 3722
3695 } // namespace internal 3723 } // namespace internal
3696 } // namespace v8 3724 } // namespace v8
OLDNEW
« no previous file with comments | « src/accessors.cc ('k') | src/contexts.h » ('j') | src/js/array-iterator.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698