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

Unified Diff: src/hydrogen.cc

Issue 136643008: A64: Synchronize with r18256. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-check-elimination.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 5721aab6d3038ade895c687c49a5dea6f63e272f..4518dbe391b6fd93ac36310fd3ad7cc4650edf87 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -1604,7 +1604,7 @@ HValue* HGraphBuilder::BuildNumberToString(HValue* object,
if_objectissmi.Else();
{
if (type->Is(Type::Smi())) {
- if_objectissmi.Deopt("Excepted smi");
+ if_objectissmi.Deopt("Expected smi");
} else {
// Check if the object is a heap number.
IfBuilder if_objectisnumber(this);
@@ -2239,25 +2239,8 @@ HInnerAllocatedObject* HGraphBuilder::BuildJSArrayHeader(HValue* array,
length_field);
if (mode == TRACK_ALLOCATION_SITE) {
- BuildCreateAllocationMemento(array,
- JSArray::kSize,
- allocation_site_payload);
- if (FLAG_allocation_site_pretenuring) {
- // TODO(mvstanton): move this code into BuildCreateAllocationMemento when
- // constructed arrays also pay attention to pretenuring.
- HObjectAccess access =
- HObjectAccess::ForAllocationSiteOffset(
- AllocationSite::kMementoCreateCountOffset);
- HValue* create_info = Add<HLoadNamedField>(allocation_site_payload,
- access);
- HInstruction* new_create_info =
- AddUncasted<HAdd>(create_info, graph()->GetConstant1());
- new_create_info->ClearFlag(HValue::kCanOverflow);
- HStoreNamedField* store = Add<HStoreNamedField>(allocation_site_payload,
- access, new_create_info);
- // No write barrier needed to store a smi.
- store->SkipWriteBarrier();
- }
+ BuildCreateAllocationMemento(
+ array, Add<HConstant>(JSArray::kSize), allocation_site_payload);
}
int elements_location = JSArray::kSize;
@@ -2265,9 +2248,10 @@ HInnerAllocatedObject* HGraphBuilder::BuildJSArrayHeader(HValue* array,
elements_location += AllocationMemento::kSize;
}
- HValue* elements = Add<HInnerAllocatedObject>(array, elements_location);
+ HInnerAllocatedObject* elements = Add<HInnerAllocatedObject>(
+ array, Add<HConstant>(elements_location));
Add<HStoreNamedField>(array, HObjectAccess::ForElementsPointer(), elements);
- return static_cast<HInnerAllocatedObject*>(elements);
+ return elements;
}
@@ -2497,7 +2481,8 @@ HValue* HGraphBuilder::BuildCloneShallowArray(HValue* boilerplate,
// Create an allocation site info if requested.
if (mode == TRACK_ALLOCATION_SITE) {
- BuildCreateAllocationMemento(object, JSArray::kSize, allocation_site);
+ BuildCreateAllocationMemento(
+ object, Add<HConstant>(JSArray::kSize), allocation_site);
}
if (length > 0) {
@@ -2590,18 +2575,34 @@ void HGraphBuilder::BuildCompareNil(
}
-HValue* HGraphBuilder::BuildCreateAllocationMemento(HValue* previous_object,
- int previous_object_size,
- HValue* alloc_site) {
- ASSERT(alloc_site != NULL);
- HInnerAllocatedObject* alloc_memento = Add<HInnerAllocatedObject>(
+void HGraphBuilder::BuildCreateAllocationMemento(
+ HValue* previous_object,
+ HValue* previous_object_size,
+ HValue* allocation_site) {
+ ASSERT(allocation_site != NULL);
+ HInnerAllocatedObject* allocation_memento = Add<HInnerAllocatedObject>(
previous_object, previous_object_size);
- Handle<Map> alloc_memento_map =
- isolate()->factory()->allocation_memento_map();
- AddStoreMapConstant(alloc_memento, alloc_memento_map);
- HObjectAccess access = HObjectAccess::ForAllocationMementoSite();
- Add<HStoreNamedField>(alloc_memento, access, alloc_site);
- return alloc_memento;
+ AddStoreMapConstant(
+ allocation_memento, isolate()->factory()->allocation_memento_map());
+ Add<HStoreNamedField>(
+ allocation_memento,
+ HObjectAccess::ForAllocationMementoSite(),
+ allocation_site);
+ if (FLAG_allocation_site_pretenuring) {
+ HValue* memento_create_count = Add<HLoadNamedField>(
+ allocation_site, HObjectAccess::ForAllocationSiteOffset(
+ AllocationSite::kMementoCreateCountOffset));
+ memento_create_count = AddUncasted<HAdd>(
+ memento_create_count, graph()->GetConstant1());
+ // This smi value is reset to zero after every gc, overflow isn't a problem
+ // since the counter is bounded by the new space size.
+ memento_create_count->ClearFlag(HValue::kCanOverflow);
+ HStoreNamedField* store = Add<HStoreNamedField>(
+ allocation_site, HObjectAccess::ForAllocationSiteOffset(
+ AllocationSite::kMementoCreateCountOffset), memento_create_count);
+ // No write barrier needed to store a smi.
+ store->SkipWriteBarrier();
+ }
}
@@ -3572,15 +3573,8 @@ void TestContext::BuildBranch(HValue* value) {
if (value != NULL && value->CheckFlag(HValue::kIsArguments)) {
builder->Bailout(kArgumentsObjectValueInATestContext);
}
- HBasicBlock* empty_true = builder->graph()->CreateBasicBlock();
- HBasicBlock* empty_false = builder->graph()->CreateBasicBlock();
ToBooleanStub::Types expected(condition()->to_boolean_types());
- builder->FinishCurrentBlock(builder->New<HBranch>(
- value, expected, empty_true, empty_false));
-
- owner()->Goto(empty_true, if_true(), builder->function_state());
- owner()->Goto(empty_false , if_false(), builder->function_state());
- builder->set_current_block(NULL);
+ ReturnControl(owner()->New<HBranch>(value, expected), BailoutId::None());
}
@@ -7579,12 +7573,6 @@ bool HOptimizedGraphBuilder::TryCallApply(Call* expr) {
// Found pattern f.apply(receiver, arguments).
CHECK_ALIVE_OR_RETURN(VisitForValue(prop->obj()), true);
HValue* function = Top();
- // The function get here may be an undefined constant if lookup fails.
- if (function->IsConstant() &&
- !HConstant::cast(function)->handle(isolate())->IsJSFunction()) {
- Drop(1);
- return false;
- }
AddCheckConstantFunction(expr->holder(), function, function_map);
Drop(1);
@@ -7616,10 +7604,10 @@ bool HOptimizedGraphBuilder::TryCallApply(Call* expr) {
}
Handle<JSFunction> known_function;
- if (function->IsConstant()) {
- HConstant* constant_function = HConstant::cast(function);
+ if (function->IsConstant() &&
+ HConstant::cast(function)->handle(isolate())->IsJSFunction()) {
known_function = Handle<JSFunction>::cast(
- constant_function->handle(isolate()));
+ HConstant::cast(function)->handle(isolate()));
int args_count = arguments_count - 1; // Excluding receiver.
if (TryInlineApply(known_function, expr, args_count)) return true;
}
@@ -8892,8 +8880,10 @@ HValue* HGraphBuilder::BuildBinaryOperation(
case Token::MOD: {
if (fixed_right_arg.has_value) {
if (right->IsConstant()) {
- ASSERT_EQ(fixed_right_arg.value,
- HConstant::cast(right)->Integer32Value());
+ HConstant* c_right = HConstant::cast(right);
+ if (c_right->HasInteger32Value()) {
+ ASSERT_EQ(fixed_right_arg.value, c_right->Integer32Value());
+ }
} else {
HConstant* fixed_right = Add<HConstant>(
static_cast<int>(fixed_right_arg.value));
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-check-elimination.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698