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

Side by Side Diff: src/factory.cc

Issue 1109353003: Unify internal and external typed arrays a bit (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 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
« no previous file with comments | « src/contexts.h ('k') | src/hydrogen.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/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/conversions.h" 10 #include "src/conversions.h"
(...skipping 1969 matching lines...) Expand 10 before | Expand all | Expand 10 after
1980 CHECK(number_of_elements <= static_cast<size_t>(Smi::kMaxValue)); 1980 CHECK(number_of_elements <= static_cast<size_t>(Smi::kMaxValue));
1981 size_t byte_length = number_of_elements * element_size; 1981 size_t byte_length = number_of_elements * element_size;
1982 1982
1983 obj->set_byte_offset(Smi::FromInt(0)); 1983 obj->set_byte_offset(Smi::FromInt(0));
1984 i::Handle<i::Object> byte_length_object = 1984 i::Handle<i::Object> byte_length_object =
1985 isolate()->factory()->NewNumberFromSize(byte_length); 1985 isolate()->factory()->NewNumberFromSize(byte_length);
1986 obj->set_byte_length(*byte_length_object); 1986 obj->set_byte_length(*byte_length_object);
1987 Handle<Object> length_object = NewNumberFromSize(number_of_elements); 1987 Handle<Object> length_object = NewNumberFromSize(number_of_elements);
1988 obj->set_length(*length_object); 1988 obj->set_length(*length_object);
1989 1989
1990 obj->set_buffer(Smi::FromInt(0)); 1990 Handle<JSArrayBuffer> buffer = isolate()->factory()->NewJSArrayBuffer();
1991 Runtime::SetupArrayBuffer(isolate(), buffer, true, NULL, byte_length);
1992 obj->set_buffer(*buffer);
1991 Handle<FixedTypedArrayBase> elements = 1993 Handle<FixedTypedArrayBase> elements =
1992 isolate()->factory()->NewFixedTypedArray( 1994 isolate()->factory()->NewFixedTypedArray(
1993 static_cast<int>(number_of_elements), array_type); 1995 static_cast<int>(number_of_elements), array_type);
1994 obj->set_elements(*elements); 1996 obj->set_elements(*elements);
1995 return obj; 1997 return obj;
1996 } 1998 }
1997 1999
1998 2000
1999 Handle<JSDataView> Factory::NewJSDataView(Handle<JSArrayBuffer> buffer, 2001 Handle<JSDataView> Factory::NewJSDataView(Handle<JSArrayBuffer> buffer,
2000 size_t byte_offset, 2002 size_t byte_offset,
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
2475 return Handle<Object>::null(); 2477 return Handle<Object>::null();
2476 } 2478 }
2477 2479
2478 2480
2479 Handle<Object> Factory::ToBoolean(bool value) { 2481 Handle<Object> Factory::ToBoolean(bool value) {
2480 return value ? true_value() : false_value(); 2482 return value ? true_value() : false_value();
2481 } 2483 }
2482 2484
2483 2485
2484 } } // namespace v8::internal 2486 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/contexts.h ('k') | src/hydrogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698