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

Side by Side Diff: src/factory.cc

Issue 228103002: Revert "Handlify deoptimization data allocators." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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/heap.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 "factory.h" 5 #include "factory.h"
6 6
7 #include "isolate-inl.h" 7 #include "isolate-inl.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 DescriptorArray::Allocate( 149 DescriptorArray::Allocate(
150 isolate(), number_of_descriptors, slack), 150 isolate(), number_of_descriptors, slack),
151 DescriptorArray); 151 DescriptorArray);
152 } 152 }
153 153
154 154
155 Handle<DeoptimizationInputData> Factory::NewDeoptimizationInputData( 155 Handle<DeoptimizationInputData> Factory::NewDeoptimizationInputData(
156 int deopt_entry_count, 156 int deopt_entry_count,
157 PretenureFlag pretenure) { 157 PretenureFlag pretenure) {
158 ASSERT(deopt_entry_count > 0); 158 ASSERT(deopt_entry_count > 0);
159 int len = DeoptimizationInputData::LengthFor(deopt_entry_count); 159 CALL_HEAP_FUNCTION(isolate(),
160 return Handle<DeoptimizationInputData>::cast(NewFixedArray(len, pretenure)); 160 DeoptimizationInputData::Allocate(isolate(),
161 deopt_entry_count,
162 pretenure),
163 DeoptimizationInputData);
161 } 164 }
162 165
163 166
164 Handle<DeoptimizationOutputData> Factory::NewDeoptimizationOutputData( 167 Handle<DeoptimizationOutputData> Factory::NewDeoptimizationOutputData(
165 int deopt_entry_count, 168 int deopt_entry_count,
166 PretenureFlag pretenure) { 169 PretenureFlag pretenure) {
167 ASSERT(deopt_entry_count > 0); 170 ASSERT(deopt_entry_count > 0);
168 int len = DeoptimizationOutputData::LengthOfFixedArray(deopt_entry_count); 171 CALL_HEAP_FUNCTION(isolate(),
169 return Handle<DeoptimizationOutputData>::cast(NewFixedArray(len, pretenure)); 172 DeoptimizationOutputData::Allocate(isolate(),
173 deopt_entry_count,
174 pretenure),
175 DeoptimizationOutputData);
170 } 176 }
171 177
172 178
173 Handle<AccessorPair> Factory::NewAccessorPair() { 179 Handle<AccessorPair> Factory::NewAccessorPair() {
174 Handle<AccessorPair> accessors = 180 Handle<AccessorPair> accessors =
175 Handle<AccessorPair>::cast(NewStruct(ACCESSOR_PAIR_TYPE)); 181 Handle<AccessorPair>::cast(NewStruct(ACCESSOR_PAIR_TYPE));
176 accessors->set_getter(*the_hole_value(), SKIP_WRITE_BARRIER); 182 accessors->set_getter(*the_hole_value(), SKIP_WRITE_BARRIER);
177 accessors->set_setter(*the_hole_value(), SKIP_WRITE_BARRIER); 183 accessors->set_setter(*the_hole_value(), SKIP_WRITE_BARRIER);
178 accessors->set_access_flags(Smi::FromInt(0), SKIP_WRITE_BARRIER); 184 accessors->set_access_flags(Smi::FromInt(0), SKIP_WRITE_BARRIER);
179 return accessors; 185 return accessors;
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 975
970 Handle<HeapNumber> Factory::NewHeapNumber(double value, 976 Handle<HeapNumber> Factory::NewHeapNumber(double value,
971 PretenureFlag pretenure) { 977 PretenureFlag pretenure) {
972 CALL_HEAP_FUNCTION( 978 CALL_HEAP_FUNCTION(
973 isolate(), 979 isolate(),
974 isolate()->heap()->AllocateHeapNumber(value, pretenure), HeapNumber); 980 isolate()->heap()->AllocateHeapNumber(value, pretenure), HeapNumber);
975 } 981 }
976 982
977 983
978 Handle<JSObject> Factory::NewNeanderObject() { 984 Handle<JSObject> Factory::NewNeanderObject() {
979 return NewJSObjectFromMap(neander_map()); 985 CALL_HEAP_FUNCTION(
986 isolate(),
987 isolate()->heap()->AllocateJSObjectFromMap(
988 isolate()->heap()->neander_map()),
989 JSObject);
980 } 990 }
981 991
982 992
983 Handle<Object> Factory::NewTypeError(const char* message, 993 Handle<Object> Factory::NewTypeError(const char* message,
984 Vector< Handle<Object> > args) { 994 Vector< Handle<Object> > args) {
985 return NewError("MakeTypeError", message, args); 995 return NewError("MakeTypeError", message, args);
986 } 996 }
987 997
988 998
989 Handle<Object> Factory::NewTypeError(Handle<String> message) { 999 Handle<Object> Factory::NewTypeError(Handle<String> message) {
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
1432 mode)); 1442 mode));
1433 } 1443 }
1434 1444
1435 1445
1436 Handle<JSGeneratorObject> Factory::NewJSGeneratorObject( 1446 Handle<JSGeneratorObject> Factory::NewJSGeneratorObject(
1437 Handle<JSFunction> function) { 1447 Handle<JSFunction> function) {
1438 ASSERT(function->shared()->is_generator()); 1448 ASSERT(function->shared()->is_generator());
1439 JSFunction::EnsureHasInitialMap(function); 1449 JSFunction::EnsureHasInitialMap(function);
1440 Handle<Map> map(function->initial_map()); 1450 Handle<Map> map(function->initial_map());
1441 ASSERT(map->instance_type() == JS_GENERATOR_OBJECT_TYPE); 1451 ASSERT(map->instance_type() == JS_GENERATOR_OBJECT_TYPE);
1442 return Handle<JSGeneratorObject>::cast(NewJSObjectFromMap(map)); 1452 CALL_HEAP_FUNCTION(
1453 isolate(),
1454 isolate()->heap()->AllocateJSObjectFromMap(*map),
1455 JSGeneratorObject);
1443 } 1456 }
1444 1457
1445 1458
1446 Handle<JSArrayBuffer> Factory::NewJSArrayBuffer() { 1459 Handle<JSArrayBuffer> Factory::NewJSArrayBuffer() {
1447 Handle<JSFunction> array_buffer_fun( 1460 Handle<JSFunction> array_buffer_fun(
1448 isolate()->context()->native_context()->array_buffer_fun()); 1461 isolate()->context()->native_context()->array_buffer_fun());
1449 return Handle<JSArrayBuffer>::cast(NewJSObject(array_buffer_fun)); 1462 CALL_HEAP_FUNCTION(
1463 isolate(),
1464 isolate()->heap()->AllocateJSObject(*array_buffer_fun),
1465 JSArrayBuffer);
1450 } 1466 }
1451 1467
1452 1468
1453 Handle<JSDataView> Factory::NewJSDataView() { 1469 Handle<JSDataView> Factory::NewJSDataView() {
1454 Handle<JSFunction> data_view_fun( 1470 Handle<JSFunction> data_view_fun(
1455 isolate()->context()->native_context()->data_view_fun()); 1471 isolate()->context()->native_context()->data_view_fun());
1456 return Handle<JSDataView>::cast(NewJSObject(data_view_fun)); 1472 CALL_HEAP_FUNCTION(
1473 isolate(),
1474 isolate()->heap()->AllocateJSObject(*data_view_fun),
1475 JSDataView);
1457 } 1476 }
1458 1477
1459 1478
1460 static JSFunction* GetTypedArrayFun(ExternalArrayType type, 1479 static JSFunction* GetTypedArrayFun(ExternalArrayType type,
1461 Isolate* isolate) { 1480 Isolate* isolate) {
1462 Context* native_context = isolate->context()->native_context(); 1481 Context* native_context = isolate->context()->native_context();
1463 switch (type) { 1482 switch (type) {
1464 #define TYPED_ARRAY_FUN(Type, type, TYPE, ctype, size) \ 1483 #define TYPED_ARRAY_FUN(Type, type, TYPE, ctype, size) \
1465 case kExternal##Type##Array: \ 1484 case kExternal##Type##Array: \
1466 return native_context->type##_array_fun(); 1485 return native_context->type##_array_fun();
1467 1486
1468 TYPED_ARRAYS(TYPED_ARRAY_FUN) 1487 TYPED_ARRAYS(TYPED_ARRAY_FUN)
1469 #undef TYPED_ARRAY_FUN 1488 #undef TYPED_ARRAY_FUN
1470 1489
1471 default: 1490 default:
1472 UNREACHABLE(); 1491 UNREACHABLE();
1473 return NULL; 1492 return NULL;
1474 } 1493 }
1475 } 1494 }
1476 1495
1477 1496
1478 Handle<JSTypedArray> Factory::NewJSTypedArray(ExternalArrayType type) { 1497 Handle<JSTypedArray> Factory::NewJSTypedArray(ExternalArrayType type) {
1479 Handle<JSFunction> typed_array_fun_handle(GetTypedArrayFun(type, isolate())); 1498 Handle<JSFunction> typed_array_fun_handle(GetTypedArrayFun(type, isolate()));
1480 return Handle<JSTypedArray>::cast(NewJSObject(typed_array_fun_handle)); 1499
1500 CALL_HEAP_FUNCTION(
1501 isolate(),
1502 isolate()->heap()->AllocateJSObject(*typed_array_fun_handle),
1503 JSTypedArray);
1481 } 1504 }
1482 1505
1483 1506
1484 Handle<JSProxy> Factory::NewJSProxy(Handle<Object> handler, 1507 Handle<JSProxy> Factory::NewJSProxy(Handle<Object> handler,
1485 Handle<Object> prototype) { 1508 Handle<Object> prototype) {
1486 CALL_HEAP_FUNCTION( 1509 CALL_HEAP_FUNCTION(
1487 isolate(), 1510 isolate(),
1488 isolate()->heap()->AllocateJSProxy(*handler, *prototype), 1511 isolate()->heap()->AllocateJSProxy(*handler, *prototype),
1489 JSProxy); 1512 JSProxy);
1490 } 1513 }
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
1956 if (name->Equals(h->infinity_string())) return infinity_value(); 1979 if (name->Equals(h->infinity_string())) return infinity_value();
1957 return Handle<Object>::null(); 1980 return Handle<Object>::null();
1958 } 1981 }
1959 1982
1960 1983
1961 Handle<Object> Factory::ToBoolean(bool value) { 1984 Handle<Object> Factory::ToBoolean(bool value) {
1962 return value ? true_value() : false_value(); 1985 return value ? true_value() : false_value();
1963 } 1986 }
1964 1987
1965 } } // namespace v8::internal 1988 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/factory.h ('k') | src/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698