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

Side by Side Diff: src/ast.cc

Issue 9320066: Removed IsTransitionType predicate. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/objects.h » ('j') | src/objects.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 compare_type_ = STRING_ONLY; 723 compare_type_ = STRING_ONLY;
724 } else if (info.IsNonPrimitive()) { 724 } else if (info.IsNonPrimitive()) {
725 compare_type_ = OBJECT_ONLY; 725 compare_type_ = OBJECT_ONLY;
726 } else { 726 } else {
727 ASSERT(compare_type_ == NONE); 727 ASSERT(compare_type_ == NONE);
728 } 728 }
729 } 729 }
730 730
731 731
732 bool Call::ComputeTarget(Handle<Map> type, Handle<String> name) { 732 bool Call::ComputeTarget(Handle<Map> type, Handle<String> name) {
733 // If there is an interceptor, we can't compute the target for 733 // If there is an interceptor, we can't compute the target for a direct call.
734 // a direct call.
735 if (type->has_named_interceptor()) return false; 734 if (type->has_named_interceptor()) return false;
736 735
737 if (check_type_ == RECEIVER_MAP_CHECK) { 736 if (check_type_ == RECEIVER_MAP_CHECK) {
738 // For primitive checks the holder is set up to point to the 737 // For primitive checks the holder is set up to point to the corresponding
739 // corresponding prototype object, i.e. one step of the algorithm 738 // prototype object, i.e. one step of the algorithm below has been already
740 // below has been already performed. 739 // performed. For non-primitive checks we clear it to allow computing
741 // For non-primitive checks we clear it to allow computing targets 740 // targets for polymorphic calls.
742 // for polymorphic calls.
743 holder_ = Handle<JSObject>::null(); 741 holder_ = Handle<JSObject>::null();
744 } 742 }
743 LookupResult lookup(type->GetIsolate());
745 while (true) { 744 while (true) {
746 LookupResult lookup(type->GetIsolate());
747 type->LookupInDescriptors(NULL, *name, &lookup); 745 type->LookupInDescriptors(NULL, *name, &lookup);
748 // If the function wasn't found directly in the map, we start 746 // For properties we know the target iff we have a constant function.
749 // looking upwards through the prototype chain. 747 if (lookup.IsFound() && lookup.IsProperty()) {
750 if ((!lookup.IsFound() || IsTransitionType(lookup.type())) 748 if (lookup.type() == CONSTANT_FUNCTION) {
751 && type->prototype()->IsJSObject()) { 749 target_ = Handle<JSFunction>(lookup.GetConstantFunctionFromMap(*type));
752 holder_ = Handle<JSObject>(JSObject::cast(type->prototype())); 750 return true;
753 type = Handle<Map>(holder()->map()); 751 }
754 } else if (lookup.IsFound() && lookup.type() == CONSTANT_FUNCTION) {
755 target_ = Handle<JSFunction>(lookup.GetConstantFunctionFromMap(*type));
756 return true;
757 } else {
758 return false; 752 return false;
759 } 753 }
754 // If we reach the end of the prototype chain, we don't know the target.
755 if (!type->prototype()->IsJSObject()) return false;
756 // Go up the prototype chain, recording where we are currently.
757 holder_ = Handle<JSObject>(JSObject::cast(type->prototype()));
758 type = Handle<Map>(holder()->map());
760 } 759 }
761 } 760 }
762 761
763 762
764 bool Call::ComputeGlobalTarget(Handle<GlobalObject> global, 763 bool Call::ComputeGlobalTarget(Handle<GlobalObject> global,
765 LookupResult* lookup) { 764 LookupResult* lookup) {
766 target_ = Handle<JSFunction>::null(); 765 target_ = Handle<JSFunction>::null();
767 cell_ = Handle<JSGlobalPropertyCell>::null(); 766 cell_ = Handle<JSGlobalPropertyCell>::null();
768 ASSERT(lookup->IsFound() && 767 ASSERT(lookup->IsFound() &&
769 lookup->type() == NORMAL && 768 lookup->type() == NORMAL &&
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
1209 int pos) 1208 int pos)
1210 : label_(label), 1209 : label_(label),
1211 statements_(statements), 1210 statements_(statements),
1212 position_(pos), 1211 position_(pos),
1213 compare_type_(NONE), 1212 compare_type_(NONE),
1214 compare_id_(AstNode::GetNextId(isolate)), 1213 compare_id_(AstNode::GetNextId(isolate)),
1215 entry_id_(AstNode::GetNextId(isolate)) { 1214 entry_id_(AstNode::GetNextId(isolate)) {
1216 } 1215 }
1217 1216
1218 } } // namespace v8::internal 1217 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/objects.h » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698