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 9602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9613 if (!top_info()->is_tracking_positions()) SetSourcePosition(expr->position()); | 9613 if (!top_info()->is_tracking_positions()) SetSourcePosition(expr->position()); |
9614 Expression* callee = expr->expression(); | 9614 Expression* callee = expr->expression(); |
9615 int argument_count = expr->arguments()->length() + 1; // Plus receiver. | 9615 int argument_count = expr->arguments()->length() + 1; // Plus receiver. |
9616 HInstruction* call = NULL; | 9616 HInstruction* call = NULL; |
9617 | 9617 |
9618 Property* prop = callee->AsProperty(); | 9618 Property* prop = callee->AsProperty(); |
9619 if (prop != NULL) { | 9619 if (prop != NULL) { |
9620 CHECK_ALIVE(VisitForValue(prop->obj())); | 9620 CHECK_ALIVE(VisitForValue(prop->obj())); |
9621 HValue* receiver = Top(); | 9621 HValue* receiver = Top(); |
9622 | 9622 |
| 9623 // Sanity check: The receiver must be a JS-exposed kind of object, |
| 9624 // not something internal (like a Map, or FixedArray). Check this here |
| 9625 // to chase after a rare but recurring crash bug. It seems to always |
| 9626 // occur for functions beginning with "this.foo.bar()", so be selective |
| 9627 // and only insert the check for the first call (identified by slot). |
| 9628 // TODO(chromium:527994): Remove this when we have a few crash reports. |
| 9629 if (prop->key()->IsPropertyName() && |
| 9630 prop->PropertyFeedbackSlot().ToInt() == 2) { |
| 9631 IfBuilder if_heapobject(this); |
| 9632 if_heapobject.IfNot<HIsSmiAndBranch>(receiver); |
| 9633 if_heapobject.Then(); |
| 9634 { |
| 9635 IfBuilder special_map(this); |
| 9636 Factory* factory = isolate()->factory(); |
| 9637 special_map.If<HCompareMap>(receiver, factory->fixed_array_map()); |
| 9638 special_map.OrIf<HCompareMap>(receiver, factory->meta_map()); |
| 9639 special_map.Then(); |
| 9640 Add<HDebugBreak>(); |
| 9641 special_map.End(); |
| 9642 } |
| 9643 if_heapobject.End(); |
| 9644 } |
| 9645 |
9623 SmallMapList* maps; | 9646 SmallMapList* maps; |
9624 ComputeReceiverTypes(expr, receiver, &maps, zone()); | 9647 ComputeReceiverTypes(expr, receiver, &maps, zone()); |
9625 | 9648 |
9626 if (prop->key()->IsPropertyName() && maps->length() > 0) { | 9649 if (prop->key()->IsPropertyName() && maps->length() > 0) { |
9627 Handle<String> name = prop->key()->AsLiteral()->AsPropertyName(); | 9650 Handle<String> name = prop->key()->AsLiteral()->AsPropertyName(); |
9628 PropertyAccessInfo info(this, LOAD, maps->first(), name); | 9651 PropertyAccessInfo info(this, LOAD, maps->first(), name); |
9629 if (!info.CanAccessAsMonomorphic(maps)) { | 9652 if (!info.CanAccessAsMonomorphic(maps)) { |
9630 HandlePolymorphicCallNamed(expr, receiver, maps, name); | 9653 HandlePolymorphicCallNamed(expr, receiver, maps, name); |
9631 return; | 9654 return; |
9632 } | 9655 } |
(...skipping 3901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13534 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13557 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13535 } | 13558 } |
13536 | 13559 |
13537 #ifdef DEBUG | 13560 #ifdef DEBUG |
13538 graph_->Verify(false); // No full verify. | 13561 graph_->Verify(false); // No full verify. |
13539 #endif | 13562 #endif |
13540 } | 13563 } |
13541 | 13564 |
13542 } // namespace internal | 13565 } // namespace internal |
13543 } // namespace v8 | 13566 } // namespace v8 |
OLD | NEW |