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/stub-cache.cc

Issue 348313002: Introduce a PrototypeIterator template and use it all over the place (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebase Created 6 years, 6 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/string-stream.cc ('k') | tools/gyp/v8.gyp » ('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/ast.h" 9 #include "src/ast.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
11 #include "src/cpu-profiler.h" 11 #include "src/cpu-profiler.h"
12 #include "src/gdb-jit.h" 12 #include "src/gdb-jit.h"
13 #include "src/ic-inl.h" 13 #include "src/ic-inl.h"
14 #include "src/prototype-iterator.h"
14 #include "src/stub-cache.h" 15 #include "src/stub-cache.h"
15 #include "src/type-info.h" 16 #include "src/type-info.h"
16 #include "src/vm-state-inl.h" 17 #include "src/vm-state-inl.h"
17 18
18 namespace v8 { 19 namespace v8 {
19 namespace internal { 20 namespace internal {
20 21
21 // ----------------------------------------------------------------------- 22 // -----------------------------------------------------------------------
22 // StubCache implementation. 23 // StubCache implementation.
23 24
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 ? GetCodeWithFlags(flags, Handle<String>::cast(name)->ToCString().get()) 700 ? GetCodeWithFlags(flags, Handle<String>::cast(name)->ToCString().get())
700 : GetCodeWithFlags(flags, NULL); 701 : GetCodeWithFlags(flags, NULL);
701 } 702 }
702 703
703 704
704 void StubCompiler::LookupPostInterceptor(Handle<JSObject> holder, 705 void StubCompiler::LookupPostInterceptor(Handle<JSObject> holder,
705 Handle<Name> name, 706 Handle<Name> name,
706 LookupResult* lookup) { 707 LookupResult* lookup) {
707 holder->LookupOwnRealNamedProperty(name, lookup); 708 holder->LookupOwnRealNamedProperty(name, lookup);
708 if (lookup->IsFound()) return; 709 if (lookup->IsFound()) return;
709 if (holder->GetPrototype()->IsNull()) return; 710 if (SAFE_GET_PROTOTYPE_FAST(*holder)->IsNull()) return;
710 holder->GetPrototype()->Lookup(name, lookup); 711 SAFE_GET_PROTOTYPE_FAST(*holder)->Lookup(name, lookup);
711 } 712 }
712 713
713 714
714 #define __ ACCESS_MASM(masm()) 715 #define __ ACCESS_MASM(masm())
715 716
716 717
717 Register LoadStubCompiler::HandlerFrontendHeader( 718 Register LoadStubCompiler::HandlerFrontendHeader(
718 Handle<HeapType> type, 719 Handle<HeapType> type,
719 Register object_reg, 720 Register object_reg,
720 Handle<JSObject> holder, 721 Handle<JSObject> holder,
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 Handle<JSObject> object, 971 Handle<JSObject> object,
971 LookupResult* lookup, 972 LookupResult* lookup,
972 Handle<Map> transition, 973 Handle<Map> transition,
973 Handle<Name> name) { 974 Handle<Name> name) {
974 Label miss, slow; 975 Label miss, slow;
975 976
976 // Ensure no transitions to deprecated maps are followed. 977 // Ensure no transitions to deprecated maps are followed.
977 __ CheckMapDeprecated(transition, scratch1(), &miss); 978 __ CheckMapDeprecated(transition, scratch1(), &miss);
978 979
979 // Check that we are allowed to write this. 980 // Check that we are allowed to write this.
980 if (object->GetPrototype()->IsJSObject()) { 981 if (SAFE_GET_PROTOTYPE_FAST(*object)->IsJSObject()) {
981 Handle<JSObject> holder; 982 Handle<JSObject> holder;
982 // holder == object indicates that no property was found. 983 // holder == object indicates that no property was found.
983 if (lookup->holder() != *object) { 984 if (lookup->holder() != *object) {
984 holder = Handle<JSObject>(lookup->holder()); 985 holder = Handle<JSObject>(lookup->holder());
985 } else { 986 } else {
986 // Find the top object. 987 // Find the top object.
987 holder = object; 988 holder = object;
988 do { 989 for (PrototypeIterator<STORE_AS_POINTER, MAP_BASED_WALK,
989 holder = Handle<JSObject>(JSObject::cast(holder->GetPrototype())); 990 END_AT_NULL_VALUE> iter(*holder);
990 } while (holder->GetPrototype()->IsJSObject()); 991 !iter.IsAtEnd(); iter.Advance()) {
992 SLOW_ASSERT(iter.GetCurrent()->IsJSObject());
993 holder = Handle<JSObject>(JSObject::cast(iter.GetCurrent()));
994 }
991 } 995 }
992 996
993 Register holder_reg = HandlerFrontendHeader( 997 Register holder_reg = HandlerFrontendHeader(
994 IC::CurrentTypeOf(object, isolate()), receiver(), holder, name, &miss); 998 IC::CurrentTypeOf(object, isolate()), receiver(), holder, name, &miss);
995 999
996 // If no property was found, and the holder (the last object in the 1000 // If no property was found, and the holder (the last object in the
997 // prototype chain) is in slow mode, we need to do a negative lookup on the 1001 // prototype chain) is in slow mode, we need to do a negative lookup on the
998 // holder. 1002 // holder.
999 if (lookup->holder() == *object) { 1003 if (lookup->holder() == *object) {
1000 GenerateNegativeHolderLookup(masm(), holder, holder_reg, name, &miss); 1004 GenerateNegativeHolderLookup(masm(), holder, holder_reg, name, &miss);
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
1426 Handle<FunctionTemplateInfo>( 1430 Handle<FunctionTemplateInfo>(
1427 FunctionTemplateInfo::cast(signature->receiver())); 1431 FunctionTemplateInfo::cast(signature->receiver()));
1428 } 1432 }
1429 } 1433 }
1430 1434
1431 is_simple_api_call_ = true; 1435 is_simple_api_call_ = true;
1432 } 1436 }
1433 1437
1434 1438
1435 } } // namespace v8::internal 1439 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/string-stream.cc ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698