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

Side by Side Diff: src/ic/handler-compiler.cc

Issue 1276533003: [runtime] Store constructor function index on primitive maps. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix arm failures Created 5 years, 4 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
« no previous file with comments | « src/ia32/builtins-ia32.cc ('k') | src/ic/ic-inl.h » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/cpu-profiler.h" 7 #include "src/cpu-profiler.h"
8 #include "src/ic/call-optimization.h" 8 #include "src/ic/call-optimization.h"
9 #include "src/ic/handler-compiler.h" 9 #include "src/ic/handler-compiler.h"
10 #include "src/ic/ic.h" 10 #include "src/ic/ic.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 } 92 }
93 93
94 94
95 #define __ ACCESS_MASM(masm()) 95 #define __ ACCESS_MASM(masm())
96 96
97 97
98 Register NamedLoadHandlerCompiler::FrontendHeader(Register object_reg, 98 Register NamedLoadHandlerCompiler::FrontendHeader(Register object_reg,
99 Handle<Name> name, 99 Handle<Name> name,
100 Label* miss, 100 Label* miss,
101 ReturnHolder return_what) { 101 ReturnHolder return_what) {
102 PrototypeCheckType check_type = CHECK_ALL_MAPS; 102 PrototypeCheckType check_type = SKIP_RECEIVER;
103 int function_index = -1; 103 int function_index = map()->IsPrimitiveMap()
104 if (map()->instance_type() < FIRST_NONSTRING_TYPE) { 104 ? map()->GetConstructorFunctionIndex()
105 function_index = Context::STRING_FUNCTION_INDEX; 105 : Map::kNoConstructorFunctionIndex;
106 } else if (map()->instance_type() == SYMBOL_TYPE) { 106 if (function_index != Map::kNoConstructorFunctionIndex) {
107 function_index = Context::SYMBOL_FUNCTION_INDEX;
108 } else if (map()->instance_type() == HEAP_NUMBER_TYPE) {
109 function_index = Context::NUMBER_FUNCTION_INDEX;
110 } else if (*map() == isolate()->heap()->boolean_map()) {
111 function_index = Context::BOOLEAN_FUNCTION_INDEX;
112 // clang-format off
113 #define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \
114 } else if (map().is_identical_to(isolate()->factory()->type##_map())) { \
115 function_index = Context::TYPE##_FUNCTION_INDEX;
116 SIMD128_TYPES(SIMD128_TYPE)
117 #undef SIMD128_TYPE
118 // clang-format on
119 } else {
120 check_type = SKIP_RECEIVER;
121 }
122
123 if (check_type == CHECK_ALL_MAPS) {
124 GenerateDirectLoadGlobalFunctionPrototype(masm(), function_index, 107 GenerateDirectLoadGlobalFunctionPrototype(masm(), function_index,
125 scratch1(), miss); 108 scratch1(), miss);
126 Object* function = isolate()->native_context()->get(function_index); 109 Object* function = isolate()->native_context()->get(function_index);
127 Object* prototype = JSFunction::cast(function)->instance_prototype(); 110 Object* prototype = JSFunction::cast(function)->instance_prototype();
128 Handle<Map> map(JSObject::cast(prototype)->map()); 111 Handle<Map> map(JSObject::cast(prototype)->map());
129 set_map(map); 112 set_map(map);
130 object_reg = scratch1(); 113 object_reg = scratch1();
114 check_type = CHECK_ALL_MAPS;
131 } 115 }
132 116
133 // Check that the maps starting from the prototype haven't changed. 117 // Check that the maps starting from the prototype haven't changed.
134 return CheckPrototypes(object_reg, scratch1(), scratch2(), scratch3(), name, 118 return CheckPrototypes(object_reg, scratch1(), scratch2(), scratch3(), name,
135 miss, check_type, return_what); 119 miss, check_type, return_what);
136 } 120 }
137 121
138 122
139 // Frontend for store uses the name register. It has to be restored before a 123 // Frontend for store uses the name register. It has to be restored before a
140 // miss. 124 // miss.
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 : kNoExtraICState); 576 : kNoExtraICState);
593 cached_stub = LoadDictionaryElementStub(isolate(), state).GetCode(); 577 cached_stub = LoadDictionaryElementStub(isolate(), state).GetCode();
594 } 578 }
595 } 579 }
596 580
597 handlers->Add(cached_stub); 581 handlers->Add(cached_stub);
598 } 582 }
599 } 583 }
600 } // namespace internal 584 } // namespace internal
601 } // namespace v8 585 } // namespace v8
OLDNEW
« no previous file with comments | « src/ia32/builtins-ia32.cc ('k') | src/ic/ic-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698