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

Side by Side Diff: src/type-info.cc

Issue 132963012: Pretenure call new support. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE. Created 6 years, 9 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/runtime.cc ('k') | src/x64/builtins-x64.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 // 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 Handle<Code> code = Handle<Code>::cast(maybe_code); 113 Handle<Code> code = Handle<Code>::cast(maybe_code);
114 return code->is_keyed_store_stub() && 114 return code->is_keyed_store_stub() &&
115 code->ic_state() == POLYMORPHIC; 115 code->ic_state() == POLYMORPHIC;
116 } 116 }
117 return false; 117 return false;
118 } 118 }
119 119
120 120
121 bool TypeFeedbackOracle::CallIsMonomorphic(int slot) { 121 bool TypeFeedbackOracle::CallIsMonomorphic(int slot) {
122 Handle<Object> value = GetInfo(slot); 122 Handle<Object> value = GetInfo(slot);
123 return value->IsAllocationSite() || value->IsJSFunction(); 123 return FLAG_pretenuring_call_new
124 ? value->IsJSFunction()
125 : value->IsAllocationSite() || value->IsJSFunction();
124 } 126 }
125 127
126 128
127 bool TypeFeedbackOracle::CallNewIsMonomorphic(int slot) { 129 bool TypeFeedbackOracle::CallNewIsMonomorphic(int slot) {
128 Handle<Object> info = GetInfo(slot); 130 Handle<Object> info = GetInfo(slot);
129 return info->IsAllocationSite() || info->IsJSFunction(); 131 return FLAG_pretenuring_call_new
132 ? info->IsJSFunction()
133 : info->IsAllocationSite() || info->IsJSFunction();
130 } 134 }
131 135
132 136
133 byte TypeFeedbackOracle::ForInType(int feedback_vector_slot) { 137 byte TypeFeedbackOracle::ForInType(int feedback_vector_slot) {
134 Handle<Object> value = GetInfo(feedback_vector_slot); 138 Handle<Object> value = GetInfo(feedback_vector_slot);
135 return value->IsSmi() && 139 return value->IsSmi() &&
136 Smi::cast(*value)->value() == TypeFeedbackInfo::kForInFastCaseMarker 140 Smi::cast(*value)->value() == TypeFeedbackInfo::kForInFastCaseMarker
137 ? ForInStatement::FAST_FOR_IN : ForInStatement::SLOW_FOR_IN; 141 ? ForInStatement::FAST_FOR_IN : ForInStatement::SLOW_FOR_IN;
138 } 142 }
139 143
140 144
141 KeyedAccessStoreMode TypeFeedbackOracle::GetStoreMode( 145 KeyedAccessStoreMode TypeFeedbackOracle::GetStoreMode(
142 TypeFeedbackId ast_id) { 146 TypeFeedbackId ast_id) {
143 Handle<Object> maybe_code = GetInfo(ast_id); 147 Handle<Object> maybe_code = GetInfo(ast_id);
144 if (maybe_code->IsCode()) { 148 if (maybe_code->IsCode()) {
145 Handle<Code> code = Handle<Code>::cast(maybe_code); 149 Handle<Code> code = Handle<Code>::cast(maybe_code);
146 if (code->kind() == Code::KEYED_STORE_IC) { 150 if (code->kind() == Code::KEYED_STORE_IC) {
147 return KeyedStoreIC::GetKeyedAccessStoreMode(code->extra_ic_state()); 151 return KeyedStoreIC::GetKeyedAccessStoreMode(code->extra_ic_state());
148 } 152 }
149 } 153 }
150 return STANDARD_STORE; 154 return STANDARD_STORE;
151 } 155 }
152 156
153 157
154 Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(int slot) { 158 Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(int slot) {
155 Handle<Object> info = GetInfo(slot); 159 Handle<Object> info = GetInfo(slot);
156 if (info->IsAllocationSite()) { 160 if (FLAG_pretenuring_call_new || info->IsJSFunction()) {
157 return Handle<JSFunction>(isolate()->native_context()->array_function());
158 } else {
159 return Handle<JSFunction>::cast(info); 161 return Handle<JSFunction>::cast(info);
160 } 162 }
163
164 ASSERT(info->IsAllocationSite());
165 return Handle<JSFunction>(isolate()->native_context()->array_function());
161 } 166 }
162 167
163 168
164 Handle<JSFunction> TypeFeedbackOracle::GetCallNewTarget(int slot) { 169 Handle<JSFunction> TypeFeedbackOracle::GetCallNewTarget(int slot) {
165 Handle<Object> info = GetInfo(slot); 170 Handle<Object> info = GetInfo(slot);
166 if (info->IsAllocationSite()) { 171 if (FLAG_pretenuring_call_new || info->IsJSFunction()) {
167 return Handle<JSFunction>(isolate()->native_context()->array_function());
168 } else {
169 return Handle<JSFunction>::cast(info); 172 return Handle<JSFunction>::cast(info);
170 } 173 }
174
175 ASSERT(info->IsAllocationSite());
176 return Handle<JSFunction>(isolate()->native_context()->array_function());
171 } 177 }
172 178
173 179
174 Handle<AllocationSite> TypeFeedbackOracle::GetCallNewAllocationSite(int slot) { 180 Handle<AllocationSite> TypeFeedbackOracle::GetCallNewAllocationSite(int slot) {
175 Handle<Object> info = GetInfo(slot); 181 Handle<Object> info = GetInfo(slot);
176 if (info->IsAllocationSite()) { 182 if (FLAG_pretenuring_call_new || info->IsAllocationSite()) {
177 return Handle<AllocationSite>::cast(info); 183 return Handle<AllocationSite>::cast(info);
178 } 184 }
179 return Handle<AllocationSite>::null(); 185 return Handle<AllocationSite>::null();
180 } 186 }
181 187
182 188
183 bool TypeFeedbackOracle::LoadIsBuiltin( 189 bool TypeFeedbackOracle::LoadIsBuiltin(
184 TypeFeedbackId id, Builtins::Name builtin) { 190 TypeFeedbackId id, Builtins::Name builtin) {
185 return *GetInfo(id) == isolate()->builtins()->builtin(builtin); 191 return *GetInfo(id) == isolate()->builtins()->builtin(builtin);
186 } 192 }
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 #ifdef DEBUG 497 #ifdef DEBUG
492 Object* result = NULL; 498 Object* result = NULL;
493 // Dictionary has been allocated with sufficient size for all elements. 499 // Dictionary has been allocated with sufficient size for all elements.
494 ASSERT(maybe_result->ToObject(&result)); 500 ASSERT(maybe_result->ToObject(&result));
495 ASSERT(*dictionary_ == result); 501 ASSERT(*dictionary_ == result);
496 #endif 502 #endif
497 } 503 }
498 504
499 505
500 } } // namespace v8::internal 506 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698