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

Side by Side Diff: src/deoptimizer.cc

Issue 9537011: Merge r10809 into 3.7 branch (Closed) Base URL: http://v8.googlecode.com/svn/branches/3.7/
Patch Set: Created 8 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 | « no previous file | src/heap.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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 data->eager_deoptimization_entry_code_ = CreateCode(type); 410 data->eager_deoptimization_entry_code_ = CreateCode(type);
411 } 411 }
412 base = data->eager_deoptimization_entry_code_; 412 base = data->eager_deoptimization_entry_code_;
413 } else { 413 } else {
414 if (data->lazy_deoptimization_entry_code_ == NULL) { 414 if (data->lazy_deoptimization_entry_code_ == NULL) {
415 data->lazy_deoptimization_entry_code_ = CreateCode(type); 415 data->lazy_deoptimization_entry_code_ = CreateCode(type);
416 } 416 }
417 base = data->lazy_deoptimization_entry_code_; 417 base = data->lazy_deoptimization_entry_code_;
418 } 418 }
419 return 419 return
420 static_cast<Address>(base->body()) + (id * table_entry_size_); 420 static_cast<Address>(base->area_start()) + (id * table_entry_size_);
421 } 421 }
422 422
423 423
424 int Deoptimizer::GetDeoptimizationId(Address addr, BailoutType type) { 424 int Deoptimizer::GetDeoptimizationId(Address addr, BailoutType type) {
425 MemoryChunk* base = NULL; 425 MemoryChunk* base = NULL;
426 DeoptimizerData* data = Isolate::Current()->deoptimizer_data(); 426 DeoptimizerData* data = Isolate::Current()->deoptimizer_data();
427 if (type == EAGER) { 427 if (type == EAGER) {
428 base = data->eager_deoptimization_entry_code_; 428 base = data->eager_deoptimization_entry_code_;
429 } else { 429 } else {
430 base = data->lazy_deoptimization_entry_code_; 430 base = data->lazy_deoptimization_entry_code_;
431 } 431 }
432 if (base == NULL || 432 if (base == NULL ||
433 addr < base->body() || 433 addr < base->area_start() ||
434 addr >= base->body() + 434 addr >= base->area_start() +
435 (kNumberOfEntries * table_entry_size_)) { 435 (kNumberOfEntries * table_entry_size_)) {
436 return kNotDeoptimizationEntry; 436 return kNotDeoptimizationEntry;
437 } 437 }
438 ASSERT_EQ(0, 438 ASSERT_EQ(0,
439 static_cast<int>(addr - base->body()) % table_entry_size_); 439 static_cast<int>(addr - base->area_start()) % table_entry_size_);
440 return static_cast<int>(addr - base->body()) / table_entry_size_; 440 return static_cast<int>(addr - base->area_start()) / table_entry_size_;
441 } 441 }
442 442
443 443
444 int Deoptimizer::GetOutputInfo(DeoptimizationOutputData* data, 444 int Deoptimizer::GetOutputInfo(DeoptimizationOutputData* data,
445 unsigned id, 445 unsigned id,
446 SharedFunctionInfo* shared) { 446 SharedFunctionInfo* shared) {
447 // TODO(kasperl): For now, we do a simple linear search for the PC 447 // TODO(kasperl): For now, we do a simple linear search for the PC
448 // offset associated with the given node id. This should probably be 448 // offset associated with the given node id. This should probably be
449 // changed to a binary search. 449 // changed to a binary search.
450 int length = data->DeoptPoints(); 450 int length = data->DeoptPoints();
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 masm.set_emit_debug_code(false); 1081 masm.set_emit_debug_code(false);
1082 GenerateDeoptimizationEntries(&masm, kNumberOfEntries, type); 1082 GenerateDeoptimizationEntries(&masm, kNumberOfEntries, type);
1083 CodeDesc desc; 1083 CodeDesc desc;
1084 masm.GetCode(&desc); 1084 masm.GetCode(&desc);
1085 ASSERT(desc.reloc_size == 0); 1085 ASSERT(desc.reloc_size == 0);
1086 1086
1087 MemoryChunk* chunk = 1087 MemoryChunk* chunk =
1088 Isolate::Current()->memory_allocator()->AllocateChunk(desc.instr_size, 1088 Isolate::Current()->memory_allocator()->AllocateChunk(desc.instr_size,
1089 EXECUTABLE, 1089 EXECUTABLE,
1090 NULL); 1090 NULL);
1091 ASSERT(chunk->area_size() >= desc.instr_size);
1091 if (chunk == NULL) { 1092 if (chunk == NULL) {
1092 V8::FatalProcessOutOfMemory("Not enough memory for deoptimization table"); 1093 V8::FatalProcessOutOfMemory("Not enough memory for deoptimization table");
1093 } 1094 }
1094 memcpy(chunk->body(), desc.buffer, desc.instr_size); 1095 memcpy(chunk->area_start(), desc.buffer, desc.instr_size);
1095 CPU::FlushICache(chunk->body(), desc.instr_size); 1096 CPU::FlushICache(chunk->area_start(), desc.instr_size);
1096 return chunk; 1097 return chunk;
1097 } 1098 }
1098 1099
1099 1100
1100 Code* Deoptimizer::FindDeoptimizingCodeFromAddress(Address addr) { 1101 Code* Deoptimizer::FindDeoptimizingCodeFromAddress(Address addr) {
1101 DeoptimizingCodeListNode* node = 1102 DeoptimizingCodeListNode* node =
1102 Isolate::Current()->deoptimizer_data()->deoptimizing_code_list_; 1103 Isolate::Current()->deoptimizer_data()->deoptimizing_code_list_;
1103 while (node != NULL) { 1104 while (node != NULL) {
1104 if (node->code()->contains(addr)) return *node->code(); 1105 if (node->code()->contains(addr)) return *node->code();
1105 node = node->next(); 1106 node = node->next();
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
1498 1499
1499 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { 1500 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) {
1500 v->VisitPointer(BitCast<Object**>(&function_)); 1501 v->VisitPointer(BitCast<Object**>(&function_));
1501 v->VisitPointers(parameters_, parameters_ + parameters_count_); 1502 v->VisitPointers(parameters_, parameters_ + parameters_count_);
1502 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); 1503 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_);
1503 } 1504 }
1504 1505
1505 #endif // ENABLE_DEBUGGER_SUPPORT 1506 #endif // ENABLE_DEBUGGER_SUPPORT
1506 1507
1507 } } // namespace v8::internal 1508 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698