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

Side by Side Diff: src/factory.cc

Issue 634473002: Revert "[turbofan] Fix lowering of typed loads/stores." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/factory.h ('k') | src/handles.h » ('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/factory.h" 5 #include "src/factory.h"
6 6
7 #include "src/allocation-site-scopes.h" 7 #include "src/allocation-site-scopes.h"
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/conversions.h" 9 #include "src/conversions.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 1698 matching lines...) Expand 10 before | Expand all | Expand 10 after
1709 Handle<JSDataView> Factory::NewJSDataView() { 1709 Handle<JSDataView> Factory::NewJSDataView() {
1710 Handle<JSFunction> data_view_fun( 1710 Handle<JSFunction> data_view_fun(
1711 isolate()->native_context()->data_view_fun()); 1711 isolate()->native_context()->data_view_fun());
1712 CALL_HEAP_FUNCTION( 1712 CALL_HEAP_FUNCTION(
1713 isolate(), 1713 isolate(),
1714 isolate()->heap()->AllocateJSObject(*data_view_fun), 1714 isolate()->heap()->AllocateJSObject(*data_view_fun),
1715 JSDataView); 1715 JSDataView);
1716 } 1716 }
1717 1717
1718 1718
1719 namespace { 1719 static JSFunction* GetTypedArrayFun(ExternalArrayType type, Isolate* isolate) {
1720
1721 ElementsKind GetExternalArrayElementsKind(ExternalArrayType type) {
1722 switch (type) {
1723 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
1724 case kExternal##Type##Array: \
1725 return EXTERNAL_##TYPE##_ELEMENTS;
1726 TYPED_ARRAYS(TYPED_ARRAY_CASE)
1727 }
1728 UNREACHABLE();
1729 return FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND;
1730 #undef TYPED_ARRAY_CASE
1731 }
1732
1733
1734 JSFunction* GetTypedArrayFun(ExternalArrayType type, Isolate* isolate) {
1735 Context* native_context = isolate->context()->native_context(); 1720 Context* native_context = isolate->context()->native_context();
1736 switch (type) { 1721 switch (type) {
1737 #define TYPED_ARRAY_FUN(Type, type, TYPE, ctype, size) \ 1722 #define TYPED_ARRAY_FUN(Type, type, TYPE, ctype, size) \
1738 case kExternal##Type##Array: \ 1723 case kExternal##Type##Array: \
1739 return native_context->type##_array_fun(); 1724 return native_context->type##_array_fun();
1740 1725
1741 TYPED_ARRAYS(TYPED_ARRAY_FUN) 1726 TYPED_ARRAYS(TYPED_ARRAY_FUN)
1742 #undef TYPED_ARRAY_FUN 1727 #undef TYPED_ARRAY_FUN
1743 1728
1744 default: 1729 default:
1745 UNREACHABLE(); 1730 UNREACHABLE();
1746 return NULL; 1731 return NULL;
1747 } 1732 }
1748 } 1733 }
1749 1734
1750 } // namespace
1751
1752 1735
1753 Handle<JSTypedArray> Factory::NewJSTypedArray(ExternalArrayType type) { 1736 Handle<JSTypedArray> Factory::NewJSTypedArray(ExternalArrayType type) {
1754 Handle<JSFunction> typed_array_fun_handle(GetTypedArrayFun(type, isolate())); 1737 Handle<JSFunction> typed_array_fun_handle(GetTypedArrayFun(type, isolate()));
1755 1738
1756 CALL_HEAP_FUNCTION( 1739 CALL_HEAP_FUNCTION(
1757 isolate(), 1740 isolate(),
1758 isolate()->heap()->AllocateJSObject(*typed_array_fun_handle), 1741 isolate()->heap()->AllocateJSObject(*typed_array_fun_handle),
1759 JSTypedArray); 1742 JSTypedArray);
1760 } 1743 }
1761 1744
1762 1745
1763 Handle<JSTypedArray> Factory::NewJSTypedArray(ExternalArrayType type,
1764 Handle<JSArrayBuffer> buffer,
1765 size_t length) {
1766 DCHECK(length <= static_cast<size_t>(kMaxInt));
1767 Handle<JSTypedArray> array = NewJSTypedArray(type);
1768 array->set_buffer(*buffer);
1769 array->set_weak_next(buffer->weak_first_view());
1770 buffer->set_weak_first_view(*array);
1771 array->set_byte_offset(Smi::FromInt(0));
1772 array->set_byte_length(buffer->byte_length());
1773 Handle<Object> length_handle = NewNumberFromSize(length);
1774 array->set_length(*length_handle);
1775 Handle<ExternalArray> elements =
1776 NewExternalArray(static_cast<int>(length), type, buffer->backing_store());
1777 JSObject::SetMapAndElements(array,
1778 JSObject::GetElementsTransitionMap(
1779 array, GetExternalArrayElementsKind(type)),
1780 elements);
1781 return array;
1782 }
1783
1784
1785 Handle<JSProxy> Factory::NewJSProxy(Handle<Object> handler, 1746 Handle<JSProxy> Factory::NewJSProxy(Handle<Object> handler,
1786 Handle<Object> prototype) { 1747 Handle<Object> prototype) {
1787 // Allocate map. 1748 // Allocate map.
1788 // TODO(rossberg): Once we optimize proxies, think about a scheme to share 1749 // TODO(rossberg): Once we optimize proxies, think about a scheme to share
1789 // maps. Will probably depend on the identity of the handler object, too. 1750 // maps. Will probably depend on the identity of the handler object, too.
1790 Handle<Map> map = NewMap(JS_PROXY_TYPE, JSProxy::kSize); 1751 Handle<Map> map = NewMap(JS_PROXY_TYPE, JSProxy::kSize);
1791 map->set_prototype(*prototype); 1752 map->set_prototype(*prototype);
1792 1753
1793 // Allocate the proxy object. 1754 // Allocate the proxy object.
1794 Handle<JSProxy> result = New<JSProxy>(map, NEW_SPACE); 1755 Handle<JSProxy> result = New<JSProxy>(map, NEW_SPACE);
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
2436 return Handle<Object>::null(); 2397 return Handle<Object>::null();
2437 } 2398 }
2438 2399
2439 2400
2440 Handle<Object> Factory::ToBoolean(bool value) { 2401 Handle<Object> Factory::ToBoolean(bool value) {
2441 return value ? true_value() : false_value(); 2402 return value ? true_value() : false_value();
2442 } 2403 }
2443 2404
2444 2405
2445 } } // namespace v8::internal 2406 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/factory.h ('k') | src/handles.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698