OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/hydrogen.h" | 5 #include "src/hydrogen.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/allocation-site-scopes.h" | 9 #include "src/allocation-site-scopes.h" |
10 #include "src/ast-numbering.h" | 10 #include "src/ast-numbering.h" |
(...skipping 9608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9619 if (!top_info()->is_tracking_positions()) SetSourcePosition(expr->position()); | 9619 if (!top_info()->is_tracking_positions()) SetSourcePosition(expr->position()); |
9620 Expression* callee = expr->expression(); | 9620 Expression* callee = expr->expression(); |
9621 int argument_count = expr->arguments()->length() + 1; // Plus receiver. | 9621 int argument_count = expr->arguments()->length() + 1; // Plus receiver. |
9622 HInstruction* call = NULL; | 9622 HInstruction* call = NULL; |
9623 | 9623 |
9624 Property* prop = callee->AsProperty(); | 9624 Property* prop = callee->AsProperty(); |
9625 if (prop != NULL) { | 9625 if (prop != NULL) { |
9626 CHECK_ALIVE(VisitForValue(prop->obj())); | 9626 CHECK_ALIVE(VisitForValue(prop->obj())); |
9627 HValue* receiver = Top(); | 9627 HValue* receiver = Top(); |
9628 | 9628 |
9629 // Sanity check: The receiver must be a JS-exposed kind of object, | |
9630 // not something internal (like a Map, or FixedArray). Check this here | |
9631 // to chase after a rare but recurring crash bug. It seems to always | |
9632 // occur for functions beginning with "this.foo.bar()", so be selective | |
9633 // and only insert the check for the first call (identified by slot). | |
9634 // TODO(chromium:527994): Remove this when we have a few crash reports. | |
9635 if (prop->key()->IsPropertyName() && | |
9636 prop->PropertyFeedbackSlot().ToInt() == 2) { | |
9637 IfBuilder if_heapobject(this); | |
9638 if_heapobject.IfNot<HIsSmiAndBranch>(receiver); | |
9639 if_heapobject.Then(); | |
9640 { | |
9641 IfBuilder special_map(this); | |
9642 Factory* factory = isolate()->factory(); | |
9643 special_map.If<HCompareMap>(receiver, factory->fixed_array_map()); | |
9644 special_map.OrIf<HCompareMap>(receiver, factory->meta_map()); | |
9645 special_map.Then(); | |
9646 Add<HDebugBreak>(); | |
9647 special_map.End(); | |
9648 } | |
9649 if_heapobject.End(); | |
9650 } | |
9651 | |
9652 SmallMapList* maps; | 9629 SmallMapList* maps; |
9653 ComputeReceiverTypes(expr, receiver, &maps, zone()); | 9630 ComputeReceiverTypes(expr, receiver, &maps, zone()); |
9654 | 9631 |
9655 if (prop->key()->IsPropertyName() && maps->length() > 0) { | 9632 if (prop->key()->IsPropertyName() && maps->length() > 0) { |
9656 Handle<String> name = prop->key()->AsLiteral()->AsPropertyName(); | 9633 Handle<String> name = prop->key()->AsLiteral()->AsPropertyName(); |
9657 PropertyAccessInfo info(this, LOAD, maps->first(), name); | 9634 PropertyAccessInfo info(this, LOAD, maps->first(), name); |
9658 if (!info.CanAccessAsMonomorphic(maps)) { | 9635 if (!info.CanAccessAsMonomorphic(maps)) { |
9659 HandlePolymorphicCallNamed(expr, receiver, maps, name); | 9636 HandlePolymorphicCallNamed(expr, receiver, maps, name); |
9660 return; | 9637 return; |
9661 } | 9638 } |
(...skipping 3958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13620 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13597 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13621 } | 13598 } |
13622 | 13599 |
13623 #ifdef DEBUG | 13600 #ifdef DEBUG |
13624 graph_->Verify(false); // No full verify. | 13601 graph_->Verify(false); // No full verify. |
13625 #endif | 13602 #endif |
13626 } | 13603 } |
13627 | 13604 |
13628 } // namespace internal | 13605 } // namespace internal |
13629 } // namespace v8 | 13606 } // namespace v8 |
OLD | NEW |