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

Side by Side Diff: src/builtins.cc

Issue 376233002: Introduce a PrototypeIterator class and use it for prototype access (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 6 years, 5 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 | « src/api.cc ('k') | src/ic.cc » ('j') | 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 // 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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/arguments.h" 8 #include "src/arguments.h"
9 #include "src/base/once.h" 9 #include "src/base/once.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
11 #include "src/builtins.h" 11 #include "src/builtins.h"
12 #include "src/cpu-profiler.h" 12 #include "src/cpu-profiler.h"
13 #include "src/gdb-jit.h" 13 #include "src/gdb-jit.h"
14 #include "src/heap-profiler.h" 14 #include "src/heap-profiler.h"
15 #include "src/ic-inl.h" 15 #include "src/ic-inl.h"
16 #include "src/mark-compact.h" 16 #include "src/mark-compact.h"
17 #include "src/prototype.h"
17 #include "src/stub-cache.h" 18 #include "src/stub-cache.h"
18 #include "src/vm-state-inl.h" 19 #include "src/vm-state-inl.h"
19 20
20 namespace v8 { 21 namespace v8 {
21 namespace internal { 22 namespace internal {
22 23
23 namespace { 24 namespace {
24 25
25 // Arguments object passed to C++ builtins. 26 // Arguments object passed to C++ builtins.
26 template <BuiltinExtraArguments extra_args> 27 template <BuiltinExtraArguments extra_args>
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after
1084 // ----------------------------------------------------------------------------- 1085 // -----------------------------------------------------------------------------
1085 // 1086 //
1086 1087
1087 1088
1088 // Searches the hidden prototype chain of the given object for the first 1089 // Searches the hidden prototype chain of the given object for the first
1089 // object that is an instance of the given type. If no such object can 1090 // object that is an instance of the given type. If no such object can
1090 // be found then Heap::null_value() is returned. 1091 // be found then Heap::null_value() is returned.
1091 static inline Object* FindHidden(Heap* heap, 1092 static inline Object* FindHidden(Heap* heap,
1092 Object* object, 1093 Object* object,
1093 FunctionTemplateInfo* type) { 1094 FunctionTemplateInfo* type) {
1094 if (type->IsTemplateFor(object)) return object; 1095 for (PrototypeIterator iter(heap->isolate(), object,
1095 Object* proto = object->GetPrototype(heap->isolate()); 1096 PrototypeIterator::START_AT_RECEIVER);
1096 if (proto->IsJSObject() && 1097 !iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN); iter.Advance()) {
1097 JSObject::cast(proto)->map()->is_hidden_prototype()) { 1098 if (type->IsTemplateFor(iter.GetCurrent())) {
1098 return FindHidden(heap, proto, type); 1099 return iter.GetCurrent();
1100 }
1099 } 1101 }
1100 return heap->null_value(); 1102 return heap->null_value();
1101 } 1103 }
1102 1104
1103 1105
1104 // Returns the holder JSObject if the function can legally be called 1106 // Returns the holder JSObject if the function can legally be called
1105 // with this receiver. Returns Heap::null_value() if the call is 1107 // with this receiver. Returns Heap::null_value() if the call is
1106 // illegal. Any arguments that don't fit the expected type is 1108 // illegal. Any arguments that don't fit the expected type is
1107 // overwritten with undefined. Note that holder and the arguments are 1109 // overwritten with undefined. Note that holder and the arguments are
1108 // implicitly rewritten with the first object in the hidden prototype 1110 // implicitly rewritten with the first object in the hidden prototype
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
1712 } 1714 }
1713 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) 1715 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C)
1714 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) 1716 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A)
1715 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) 1717 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H)
1716 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) 1718 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A)
1717 #undef DEFINE_BUILTIN_ACCESSOR_C 1719 #undef DEFINE_BUILTIN_ACCESSOR_C
1718 #undef DEFINE_BUILTIN_ACCESSOR_A 1720 #undef DEFINE_BUILTIN_ACCESSOR_A
1719 1721
1720 1722
1721 } } // namespace v8::internal 1723 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698