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

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

Issue 7374002: Refactor allocation policies. Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 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/string-stream.cc ('k') | src/v8globals.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 Isolate* isolate = Isolate::Current(); 397 Isolate* isolate = Isolate::Current();
398 Handle<Object> object = GetInfo(ast_id); 398 Handle<Object> object = GetInfo(ast_id);
399 if (object->IsUndefined() || object->IsSmi()) return NULL; 399 if (object->IsUndefined() || object->IsSmi()) return NULL;
400 400
401 if (*object == isolate->builtins()->builtin(Builtins::kStoreIC_GlobalProxy)) { 401 if (*object == isolate->builtins()->builtin(Builtins::kStoreIC_GlobalProxy)) {
402 // TODO(fschneider): We could collect the maps and signal that 402 // TODO(fschneider): We could collect the maps and signal that
403 // we need a generic store (or load) here. 403 // we need a generic store (or load) here.
404 ASSERT(Handle<Code>::cast(object)->ic_state() == MEGAMORPHIC); 404 ASSERT(Handle<Code>::cast(object)->ic_state() == MEGAMORPHIC);
405 return NULL; 405 return NULL;
406 } else if (object->IsMap()) { 406 } else if (object->IsMap()) {
407 ZoneMapList* types = new ZoneMapList(1); 407 ZoneMapList* types = ZoneMapList::New(isolate->zone(), 1);
408 types->Add(Handle<Map>::cast(object)); 408 types->Add(Handle<Map>::cast(object));
409 return types; 409 return types;
410 } else if (Handle<Code>::cast(object)->ic_state() == MEGAMORPHIC) { 410 } else if (Handle<Code>::cast(object)->ic_state() == MEGAMORPHIC) {
411 ZoneMapList* types = new ZoneMapList(4); 411 ZoneMapList* types = ZoneMapList::New(isolate->zone(), 4);
412 ASSERT(object->IsCode()); 412 ASSERT(object->IsCode());
413 isolate->stub_cache()->CollectMatchingMaps(types, *name, flags); 413 isolate->stub_cache()->CollectMatchingMaps(types, *name, flags);
414 return types->length() > 0 ? types : NULL; 414 return types->length() > 0 ? types : NULL;
415 } else { 415 } else {
416 return NULL; 416 return NULL;
417 } 417 }
418 } 418 }
419 419
420 420
421 void TypeFeedbackOracle::CollectKeyedReceiverTypes( 421 void TypeFeedbackOracle::CollectKeyedReceiverTypes(
(...skipping 15 matching lines...) Expand all
437 } 437 }
438 } 438 }
439 } 439 }
440 440
441 441
442 // Things are a bit tricky here: The iterator for the RelocInfos and the infos 442 // Things are a bit tricky here: The iterator for the RelocInfos and the infos
443 // themselves are not GC-safe, so we first get all infos, then we create the 443 // themselves are not GC-safe, so we first get all infos, then we create the
444 // dictionary (possibly triggering GC), and finally we relocate the collected 444 // dictionary (possibly triggering GC), and finally we relocate the collected
445 // infos before we process them. 445 // infos before we process them.
446 void TypeFeedbackOracle::BuildDictionary(Handle<Code> code) { 446 void TypeFeedbackOracle::BuildDictionary(Handle<Code> code) {
447 Isolate* isolate = code->GetIsolate();
447 AssertNoAllocation no_allocation; 448 AssertNoAllocation no_allocation;
448 ZoneList<RelocInfo> infos(16); 449 ZoneList<RelocInfo> infos(isolate->zone(), 16);
449 HandleScope scope; 450 HandleScope scope(isolate);
450 GetRelocInfos(code, &infos); 451 GetRelocInfos(code, &infos);
451 CreateDictionary(code, &infos); 452 CreateDictionary(code, &infos);
452 ProcessRelocInfos(&infos); 453 ProcessRelocInfos(&infos);
453 // Allocate handle in the parent scope. 454 // Allocate handle in the parent scope.
454 dictionary_ = scope.CloseAndEscape(dictionary_); 455 dictionary_ = scope.CloseAndEscape(dictionary_);
455 } 456 }
456 457
457 458
458 void TypeFeedbackOracle::GetRelocInfos(Handle<Code> code, 459 void TypeFeedbackOracle::GetRelocInfos(Handle<Code> code,
459 ZoneList<RelocInfo>* infos) { 460 ZoneList<RelocInfo>* infos) {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 USE(maybe_result); 539 USE(maybe_result);
539 #ifdef DEBUG 540 #ifdef DEBUG
540 Object* result = NULL; 541 Object* result = NULL;
541 // Dictionary has been allocated with sufficient size for all elements. 542 // Dictionary has been allocated with sufficient size for all elements.
542 ASSERT(maybe_result->ToObject(&result)); 543 ASSERT(maybe_result->ToObject(&result));
543 ASSERT(*dictionary_ == result); 544 ASSERT(*dictionary_ == result);
544 #endif 545 #endif
545 } 546 }
546 547
547 } } // namespace v8::internal 548 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/string-stream.cc ('k') | src/v8globals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698