OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 return false; | 583 return false; |
584 } | 584 } |
585 | 585 |
586 | 586 |
587 // ---------------------------------------------------------------------------- | 587 // ---------------------------------------------------------------------------- |
588 // Recording of type feedback | 588 // Recording of type feedback |
589 | 589 |
590 // TODO(rossberg): all RecordTypeFeedback functions should disappear | 590 // TODO(rossberg): all RecordTypeFeedback functions should disappear |
591 // once we use the common type field in the AST consistently. | 591 // once we use the common type field in the AST consistently. |
592 | 592 |
593 | |
594 void Expression::RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle) { | 593 void Expression::RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle) { |
595 to_boolean_types_ = oracle->ToBooleanTypes(test_id()); | 594 to_boolean_types_ = oracle->ToBooleanTypes(test_id()); |
596 } | 595 } |
597 | 596 |
598 | 597 |
| 598 Call::CallType Call::GetCallType(Isolate* isolate) const { |
| 599 VariableProxy* proxy = expression()->AsVariableProxy(); |
| 600 if (proxy != NULL) { |
| 601 if (proxy->var()->is_possibly_eval(isolate)) { |
| 602 return POSSIBLY_EVAL_CALL; |
| 603 } else if (proxy->var()->IsUnallocated()) { |
| 604 return GLOBAL_CALL; |
| 605 } else if (proxy->var()->IsLookupSlot()) { |
| 606 return LOOKUP_SLOT_CALL; |
| 607 } |
| 608 } |
| 609 |
| 610 Property* property = expression()->AsProperty(); |
| 611 return property != NULL ? PROPERTY_CALL : OTHER_CALL; |
| 612 } |
| 613 |
| 614 |
599 bool Call::ComputeTarget(Handle<Map> type, Handle<String> name) { | 615 bool Call::ComputeTarget(Handle<Map> type, Handle<String> name) { |
600 // If there is an interceptor, we can't compute the target for a direct call. | 616 // If there is an interceptor, we can't compute the target for a direct call. |
601 if (type->has_named_interceptor()) return false; | 617 if (type->has_named_interceptor()) return false; |
602 | 618 |
603 if (check_type_ == RECEIVER_MAP_CHECK) { | 619 if (check_type_ == RECEIVER_MAP_CHECK) { |
604 // For primitive checks the holder is set up to point to the corresponding | 620 // For primitive checks the holder is set up to point to the corresponding |
605 // prototype object, i.e. one step of the algorithm below has been already | 621 // prototype object, i.e. one step of the algorithm below has been already |
606 // performed. For non-primitive checks we clear it to allow computing | 622 // performed. For non-primitive checks we clear it to allow computing |
607 // targets for polymorphic calls. | 623 // targets for polymorphic calls. |
608 holder_ = Handle<JSObject>::null(); | 624 holder_ = Handle<JSObject>::null(); |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1261 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value()); | 1277 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value()); |
1262 str = arr; | 1278 str = arr; |
1263 } else { | 1279 } else { |
1264 str = DoubleToCString(value_->Number(), buffer); | 1280 str = DoubleToCString(value_->Number(), buffer); |
1265 } | 1281 } |
1266 return isolate_->factory()->NewStringFromAscii(CStrVector(str)); | 1282 return isolate_->factory()->NewStringFromAscii(CStrVector(str)); |
1267 } | 1283 } |
1268 | 1284 |
1269 | 1285 |
1270 } } // namespace v8::internal | 1286 } } // namespace v8::internal |
OLD | NEW |