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

Side by Side Diff: src/stub-cache.cc

Issue 67613005: Move template instance check from Object to FunctionTemplateInfo::IsTemplateFor (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month 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 | « src/stub-cache.h ('k') | no next file » | no next file with comments »
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 1767 matching lines...) Expand 10 before | Expand all | Expand 10 after
1778 } 1778 }
1779 1779
1780 1780
1781 int CallOptimization::GetPrototypeDepthOfExpectedType( 1781 int CallOptimization::GetPrototypeDepthOfExpectedType(
1782 Handle<JSObject> object, 1782 Handle<JSObject> object,
1783 Handle<JSObject> holder) const { 1783 Handle<JSObject> holder) const {
1784 ASSERT(is_simple_api_call()); 1784 ASSERT(is_simple_api_call());
1785 if (expected_receiver_type_.is_null()) return 0; 1785 if (expected_receiver_type_.is_null()) return 0;
1786 int depth = 0; 1786 int depth = 0;
1787 while (!object.is_identical_to(holder)) { 1787 while (!object.is_identical_to(holder)) {
1788 if (object->IsInstanceOf(*expected_receiver_type_)) return depth; 1788 if (expected_receiver_type_->IsTemplateFor(object->map())) return depth;
1789 object = Handle<JSObject>(JSObject::cast(object->GetPrototype())); 1789 object = Handle<JSObject>(JSObject::cast(object->GetPrototype()));
1790 if (!object->map()->is_hidden_prototype()) return kInvalidProtoDepth; 1790 if (!object->map()->is_hidden_prototype()) return kInvalidProtoDepth;
1791 ++depth; 1791 ++depth;
1792 } 1792 }
1793 if (holder->IsInstanceOf(*expected_receiver_type_)) return depth; 1793 if (expected_receiver_type_->IsTemplateFor(holder->map())) return depth;
1794 return kInvalidProtoDepth; 1794 return kInvalidProtoDepth;
1795 } 1795 }
1796 1796
1797 1797
1798 void CallOptimization::Initialize(Handle<JSFunction> function) { 1798 void CallOptimization::Initialize(Handle<JSFunction> function) {
1799 constant_function_ = Handle<JSFunction>::null(); 1799 constant_function_ = Handle<JSFunction>::null();
1800 is_simple_api_call_ = false; 1800 is_simple_api_call_ = false;
1801 expected_receiver_type_ = Handle<FunctionTemplateInfo>::null(); 1801 expected_receiver_type_ = Handle<FunctionTemplateInfo>::null();
1802 api_call_info_ = Handle<CallHandlerInfo>::null(); 1802 api_call_info_ = Handle<CallHandlerInfo>::null();
1803 1803
(...skipping 24 matching lines...) Expand all
1828 Handle<FunctionTemplateInfo>( 1828 Handle<FunctionTemplateInfo>(
1829 FunctionTemplateInfo::cast(signature->receiver())); 1829 FunctionTemplateInfo::cast(signature->receiver()));
1830 } 1830 }
1831 } 1831 }
1832 1832
1833 is_simple_api_call_ = true; 1833 is_simple_api_call_ = true;
1834 } 1834 }
1835 1835
1836 1836
1837 } } // namespace v8::internal 1837 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/stub-cache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698