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

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

Issue 10615002: Track allocation info (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Diff with b_e Created 8 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/type-info.h ('k') | test/mjsunit/elements-kind.js » ('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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 164
165 165
166 bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) { 166 bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) {
167 Handle<Object> value = GetInfo(expr->CallFeedbackId()); 167 Handle<Object> value = GetInfo(expr->CallFeedbackId());
168 return value->IsMap() || value->IsSmi() || value->IsJSFunction(); 168 return value->IsMap() || value->IsSmi() || value->IsJSFunction();
169 } 169 }
170 170
171 171
172 bool TypeFeedbackOracle::CallNewIsMonomorphic(CallNew* expr) { 172 bool TypeFeedbackOracle::CallNewIsMonomorphic(CallNew* expr) {
173 Handle<Object> value = GetInfo(expr->CallNewFeedbackId()); 173 Handle<Object> value = GetInfo(expr->CallNewFeedbackId());
174 if (value->IsSmi()) {
175 ASSERT(static_cast<ElementsKind>(Smi::cast(*value)->value()) <=
176 LAST_FAST_ELEMENTS_KIND);
177 return Isolate::Current()->global_context()->array_function();
178 }
174 return value->IsJSFunction(); 179 return value->IsJSFunction();
175 } 180 }
176 181
177 182
178 bool TypeFeedbackOracle::ObjectLiteralStoreIsMonomorphic( 183 bool TypeFeedbackOracle::ObjectLiteralStoreIsMonomorphic(
179 ObjectLiteral::Property* prop) { 184 ObjectLiteral::Property* prop) {
180 Handle<Object> map_or_code = GetInfo(prop->key()->LiteralFeedbackId()); 185 Handle<Object> map_or_code = GetInfo(prop->key()->LiteralFeedbackId());
181 return map_or_code->IsMap(); 186 return map_or_code->IsMap();
182 } 187 }
183 188
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 return Handle<JSObject>(JSObject::cast(function->instance_prototype())); 293 return Handle<JSObject>(JSObject::cast(function->instance_prototype()));
289 } 294 }
290 295
291 296
292 Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(Call* expr) { 297 Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(Call* expr) {
293 return Handle<JSFunction>::cast(GetInfo(expr->CallFeedbackId())); 298 return Handle<JSFunction>::cast(GetInfo(expr->CallFeedbackId()));
294 } 299 }
295 300
296 301
297 Handle<JSFunction> TypeFeedbackOracle::GetCallNewTarget(CallNew* expr) { 302 Handle<JSFunction> TypeFeedbackOracle::GetCallNewTarget(CallNew* expr) {
298 return Handle<JSFunction>::cast(GetInfo(expr->CallNewFeedbackId())); 303 Handle <Object> info = GetInfo(expr->CallNewFeedbackId());
304 if (info->IsSmi()) {
305 ASSERT(static_cast<ElementsKind>(Smi::cast(*info)->value()) <=
306 LAST_FAST_ELEMENTS_KIND);
307 return Handle<JSFunction>(Isolate::Current()->global_context()->
308 array_function());
309 } else {
310 return Handle<JSFunction>::cast(info);
311 }
299 } 312 }
300 313
301 314
315 ElementsKind TypeFeedbackOracle::GetCallNewElementsKind(CallNew* expr) {
316 Handle<Object> info = GetInfo(expr->CallNewFeedbackId());
317 if (info->IsSmi()) {
318 return static_cast<ElementsKind>(Smi::cast(*info)->value());
319 } else {
320 return GetInitialFastElementsKind();
321 }
322 }
323
324
302 Handle<Map> TypeFeedbackOracle::GetObjectLiteralStoreMap( 325 Handle<Map> TypeFeedbackOracle::GetObjectLiteralStoreMap(
303 ObjectLiteral::Property* prop) { 326 ObjectLiteral::Property* prop) {
304 ASSERT(ObjectLiteralStoreIsMonomorphic(prop)); 327 ASSERT(ObjectLiteralStoreIsMonomorphic(prop));
305 return Handle<Map>::cast(GetInfo(prop->key()->LiteralFeedbackId())); 328 return Handle<Map>::cast(GetInfo(prop->key()->LiteralFeedbackId()));
306 } 329 }
307 330
308 331
309 bool TypeFeedbackOracle::LoadIsBuiltin(Property* expr, Builtins::Name id) { 332 bool TypeFeedbackOracle::LoadIsBuiltin(Property* expr, Builtins::Name id) {
310 return *GetInfo(expr->PropertyFeedbackId()) == 333 return *GetInfo(expr->PropertyFeedbackId()) ==
311 isolate_->builtins()->builtin(id); 334 isolate_->builtins()->builtin(id);
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 USE(maybe_result); 751 USE(maybe_result);
729 #ifdef DEBUG 752 #ifdef DEBUG
730 Object* result = NULL; 753 Object* result = NULL;
731 // Dictionary has been allocated with sufficient size for all elements. 754 // Dictionary has been allocated with sufficient size for all elements.
732 ASSERT(maybe_result->ToObject(&result)); 755 ASSERT(maybe_result->ToObject(&result));
733 ASSERT(*dictionary_ == result); 756 ASSERT(*dictionary_ == result);
734 #endif 757 #endif
735 } 758 }
736 759
737 } } // namespace v8::internal 760 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/type-info.h ('k') | test/mjsunit/elements-kind.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698