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

Side by Side Diff: src/factory.cc

Issue 2674593003: [TypeFeedbackVector] Root feedback vectors at function literal site. (Closed)
Patch Set: REBASE+liveedit fix. Created 3 years, 10 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/factory.h ('k') | src/full-codegen/arm/full-codegen-arm.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/factory.h" 5 #include "src/factory.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/allocation-site-scopes.h" 8 #include "src/allocation-site-scopes.h"
9 #include "src/ast/ast.h" 9 #include "src/ast/ast.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 1156
1157 Handle<FixedTypedArrayBase> Factory::NewFixedTypedArray( 1157 Handle<FixedTypedArrayBase> Factory::NewFixedTypedArray(
1158 int length, ExternalArrayType array_type, bool initialize, 1158 int length, ExternalArrayType array_type, bool initialize,
1159 PretenureFlag pretenure) { 1159 PretenureFlag pretenure) {
1160 DCHECK(0 <= length && length <= Smi::kMaxValue); 1160 DCHECK(0 <= length && length <= Smi::kMaxValue);
1161 CALL_HEAP_FUNCTION(isolate(), isolate()->heap()->AllocateFixedTypedArray( 1161 CALL_HEAP_FUNCTION(isolate(), isolate()->heap()->AllocateFixedTypedArray(
1162 length, array_type, initialize, pretenure), 1162 length, array_type, initialize, pretenure),
1163 FixedTypedArrayBase); 1163 FixedTypedArrayBase);
1164 } 1164 }
1165 1165
1166
1167 Handle<Cell> Factory::NewCell(Handle<Object> value) { 1166 Handle<Cell> Factory::NewCell(Handle<Object> value) {
1168 AllowDeferredHandleDereference convert_to_cell; 1167 AllowDeferredHandleDereference convert_to_cell;
1169 CALL_HEAP_FUNCTION( 1168 CALL_HEAP_FUNCTION(
1170 isolate(), 1169 isolate(),
1171 isolate()->heap()->AllocateCell(*value), 1170 isolate()->heap()->AllocateCell(*value),
1172 Cell); 1171 Cell);
1173 } 1172 }
1174 1173
1175
1176 Handle<PropertyCell> Factory::NewPropertyCell() { 1174 Handle<PropertyCell> Factory::NewPropertyCell() {
1177 CALL_HEAP_FUNCTION( 1175 CALL_HEAP_FUNCTION(
1178 isolate(), 1176 isolate(),
1179 isolate()->heap()->AllocatePropertyCell(), 1177 isolate()->heap()->AllocatePropertyCell(),
1180 PropertyCell); 1178 PropertyCell);
1181 } 1179 }
1182 1180
1183 1181
1184 Handle<WeakCell> Factory::NewWeakCell(Handle<HeapObject> value) { 1182 Handle<WeakCell> Factory::NewWeakCell(Handle<HeapObject> value) {
1185 // It is safe to dereference the value because we are embedding it 1183 // It is safe to dereference the value because we are embedding it
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 Handle<JSFunction> function = New<JSFunction>(map, space); 1412 Handle<JSFunction> function = New<JSFunction>(map, space);
1415 DCHECK(context_or_undefined->IsContext() || 1413 DCHECK(context_or_undefined->IsContext() ||
1416 context_or_undefined->IsUndefined(isolate())); 1414 context_or_undefined->IsUndefined(isolate()));
1417 1415
1418 function->initialize_properties(); 1416 function->initialize_properties();
1419 function->initialize_elements(); 1417 function->initialize_elements();
1420 function->set_shared(*info); 1418 function->set_shared(*info);
1421 function->set_code(info->code()); 1419 function->set_code(info->code());
1422 function->set_context(*context_or_undefined); 1420 function->set_context(*context_or_undefined);
1423 function->set_prototype_or_initial_map(*the_hole_value()); 1421 function->set_prototype_or_initial_map(*the_hole_value());
1424 function->set_feedback_vector( 1422 function->set_feedback_vector_cell(*undefined_cell());
1425 TypeFeedbackVector::cast(*empty_type_feedback_vector()));
1426 function->set_next_function_link(*undefined_value(), SKIP_WRITE_BARRIER); 1423 function->set_next_function_link(*undefined_value(), SKIP_WRITE_BARRIER);
1427 isolate()->heap()->InitializeJSObjectBody(*function, *map, JSFunction::kSize); 1424 isolate()->heap()->InitializeJSObjectBody(*function, *map, JSFunction::kSize);
1428 return function; 1425 return function;
1429 } 1426 }
1430 1427
1431 1428
1432 Handle<JSFunction> Factory::NewFunction(Handle<Map> map, 1429 Handle<JSFunction> Factory::NewFunction(Handle<Map> map,
1433 Handle<String> name, 1430 Handle<String> name,
1434 MaybeHandle<Code> code) { 1431 MaybeHandle<Code> code) {
1435 Handle<Context> context(isolate()->native_context()); 1432 Handle<Context> context(isolate()->native_context());
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1548 int map_index = 1545 int map_index =
1549 Context::FunctionMapIndex(info->language_mode(), info->kind()); 1546 Context::FunctionMapIndex(info->language_mode(), info->kind());
1550 Handle<Map> initial_map(Map::cast(context->native_context()->get(map_index))); 1547 Handle<Map> initial_map(Map::cast(context->native_context()->get(map_index)));
1551 1548
1552 return NewFunctionFromSharedFunctionInfo(initial_map, info, context, 1549 return NewFunctionFromSharedFunctionInfo(initial_map, info, context,
1553 pretenure); 1550 pretenure);
1554 } 1551 }
1555 1552
1556 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo( 1553 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo(
1557 Handle<SharedFunctionInfo> info, Handle<Context> context, 1554 Handle<SharedFunctionInfo> info, Handle<Context> context,
1558 Handle<TypeFeedbackVector> vector, PretenureFlag pretenure) { 1555 Handle<Cell> vector, PretenureFlag pretenure) {
1559 int map_index = 1556 int map_index =
1560 Context::FunctionMapIndex(info->language_mode(), info->kind()); 1557 Context::FunctionMapIndex(info->language_mode(), info->kind());
1561 Handle<Map> initial_map(Map::cast(context->native_context()->get(map_index))); 1558 Handle<Map> initial_map(Map::cast(context->native_context()->get(map_index)));
1562 1559
1563 return NewFunctionFromSharedFunctionInfo(initial_map, info, context, vector, 1560 return NewFunctionFromSharedFunctionInfo(initial_map, info, context, vector,
1564 pretenure); 1561 pretenure);
1565 } 1562 }
1566 1563
1567 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo( 1564 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo(
1568 Handle<Map> initial_map, Handle<SharedFunctionInfo> info, 1565 Handle<Map> initial_map, Handle<SharedFunctionInfo> info,
1569 Handle<Object> context_or_undefined, PretenureFlag pretenure) { 1566 Handle<Object> context_or_undefined, PretenureFlag pretenure) {
1570 DCHECK_EQ(JS_FUNCTION_TYPE, initial_map->instance_type()); 1567 DCHECK_EQ(JS_FUNCTION_TYPE, initial_map->instance_type());
1571 Handle<JSFunction> result = 1568 Handle<JSFunction> result =
1572 NewFunction(initial_map, info, context_or_undefined, pretenure); 1569 NewFunction(initial_map, info, context_or_undefined, pretenure);
1573 1570
1574 if (info->ic_age() != isolate()->heap()->global_ic_age()) { 1571 if (info->ic_age() != isolate()->heap()->global_ic_age()) {
1575 info->ResetForNewContext(isolate()->heap()->global_ic_age()); 1572 info->ResetForNewContext(isolate()->heap()->global_ic_age());
1576 } 1573 }
1577 1574
1578 if (context_or_undefined->IsContext()) { 1575 if (context_or_undefined->IsContext()) {
1579 // Give compiler a chance to pre-initialize. 1576 // Give compiler a chance to pre-initialize.
1580 Compiler::PostInstantiation(result, pretenure); 1577 Compiler::PostInstantiation(result, pretenure);
1581 } 1578 }
1582 1579
1583 return result; 1580 return result;
1584 } 1581 }
1585 1582
1586 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo( 1583 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo(
1587 Handle<Map> initial_map, Handle<SharedFunctionInfo> info, 1584 Handle<Map> initial_map, Handle<SharedFunctionInfo> info,
1588 Handle<Object> context_or_undefined, Handle<TypeFeedbackVector> vector, 1585 Handle<Object> context_or_undefined, Handle<Cell> vector,
1589 PretenureFlag pretenure) { 1586 PretenureFlag pretenure) {
1590 DCHECK_EQ(JS_FUNCTION_TYPE, initial_map->instance_type()); 1587 DCHECK_EQ(JS_FUNCTION_TYPE, initial_map->instance_type());
1591 Handle<JSFunction> result = 1588 Handle<JSFunction> result =
1592 NewFunction(initial_map, info, context_or_undefined, pretenure); 1589 NewFunction(initial_map, info, context_or_undefined, pretenure);
1593 1590
1594 result->set_feedback_vector(*vector); 1591 result->set_feedback_vector_cell(*vector);
1595 if (info->ic_age() != isolate()->heap()->global_ic_age()) { 1592 if (info->ic_age() != isolate()->heap()->global_ic_age()) {
1596 info->ResetForNewContext(isolate()->heap()->global_ic_age()); 1593 info->ResetForNewContext(isolate()->heap()->global_ic_age());
1597 } 1594 }
1598 1595
1599 if (context_or_undefined->IsContext()) { 1596 if (context_or_undefined->IsContext()) {
1600 // Give compiler a chance to pre-initialize. 1597 // Give compiler a chance to pre-initialize.
1601 Compiler::PostInstantiation(result, pretenure); 1598 Compiler::PostInstantiation(result, pretenure);
1602 } 1599 }
1603 1600
1604 return result; 1601 return result;
(...skipping 1244 matching lines...) Expand 10 before | Expand all | Expand 10 after
2849 Handle<AccessorInfo> prototype = 2846 Handle<AccessorInfo> prototype =
2850 Accessors::FunctionPrototypeInfo(isolate(), rw_attribs); 2847 Accessors::FunctionPrototypeInfo(isolate(), rw_attribs);
2851 Descriptor d = Descriptor::AccessorConstant( 2848 Descriptor d = Descriptor::AccessorConstant(
2852 Handle<Name>(Name::cast(prototype->name())), prototype, rw_attribs); 2849 Handle<Name>(Name::cast(prototype->name())), prototype, rw_attribs);
2853 map->AppendDescriptor(&d); 2850 map->AppendDescriptor(&d);
2854 } 2851 }
2855 } 2852 }
2856 2853
2857 } // namespace internal 2854 } // namespace internal
2858 } // namespace v8 2855 } // namespace v8
OLDNEW
« no previous file with comments | « src/factory.h ('k') | src/full-codegen/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698