OLD | NEW |
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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 if (cgen.HasStackOverflow()) { | 296 if (cgen.HasStackOverflow()) { |
297 ASSERT(!isolate->has_pending_exception()); | 297 ASSERT(!isolate->has_pending_exception()); |
298 return false; | 298 return false; |
299 } | 299 } |
300 unsigned table_offset = cgen.EmitStackCheckTable(); | 300 unsigned table_offset = cgen.EmitStackCheckTable(); |
301 | 301 |
302 Code::Flags flags = Code::ComputeFlags(Code::FUNCTION); | 302 Code::Flags flags = Code::ComputeFlags(Code::FUNCTION); |
303 Handle<Code> code = CodeGenerator::MakeCodeEpilogue(&masm, flags, info); | 303 Handle<Code> code = CodeGenerator::MakeCodeEpilogue(&masm, flags, info); |
304 code->set_optimizable(info->IsOptimizable()); | 304 code->set_optimizable(info->IsOptimizable()); |
305 cgen.PopulateDeoptimizationData(code); | 305 cgen.PopulateDeoptimizationData(code); |
| 306 cgen.PopulateTypeFeedbackInfo(code); |
306 cgen.PopulateTypeFeedbackCells(code); | 307 cgen.PopulateTypeFeedbackCells(code); |
307 code->set_has_deoptimization_support(info->HasDeoptimizationSupport()); | 308 code->set_has_deoptimization_support(info->HasDeoptimizationSupport()); |
308 code->set_handler_table(*cgen.handler_table()); | 309 code->set_handler_table(*cgen.handler_table()); |
309 #ifdef ENABLE_DEBUGGER_SUPPORT | 310 #ifdef ENABLE_DEBUGGER_SUPPORT |
310 code->set_has_debug_break_slots( | 311 code->set_has_debug_break_slots( |
311 info->isolate()->debugger()->IsDebuggerActive()); | 312 info->isolate()->debugger()->IsDebuggerActive()); |
312 code->set_compiled_optimizable(info->IsOptimizable()); | 313 code->set_compiled_optimizable(info->IsOptimizable()); |
313 #endif // ENABLE_DEBUGGER_SUPPORT | 314 #endif // ENABLE_DEBUGGER_SUPPORT |
314 code->set_allow_osr_at_loop_nesting_level(0); | 315 code->set_allow_osr_at_loop_nesting_level(0); |
315 code->set_stack_check_table_offset(table_offset); | 316 code->set_stack_check_table_offset(table_offset); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 Handle<DeoptimizationOutputData> data = isolate()->factory()-> | 355 Handle<DeoptimizationOutputData> data = isolate()->factory()-> |
355 NewDeoptimizationOutputData(length, TENURED); | 356 NewDeoptimizationOutputData(length, TENURED); |
356 for (int i = 0; i < length; i++) { | 357 for (int i = 0; i < length; i++) { |
357 data->SetAstId(i, Smi::FromInt(bailout_entries_[i].id)); | 358 data->SetAstId(i, Smi::FromInt(bailout_entries_[i].id)); |
358 data->SetPcAndState(i, Smi::FromInt(bailout_entries_[i].pc_and_state)); | 359 data->SetPcAndState(i, Smi::FromInt(bailout_entries_[i].pc_and_state)); |
359 } | 360 } |
360 code->set_deoptimization_data(*data); | 361 code->set_deoptimization_data(*data); |
361 } | 362 } |
362 | 363 |
363 | 364 |
| 365 void FullCodeGenerator::PopulateTypeFeedbackInfo(Handle<Code> code) { |
| 366 Handle<TypeFeedbackInfo> info = isolate()->factory()->NewTypeFeedbackInfo(); |
| 367 info->set_ic_total_count(ic_total_count_); |
| 368 code->set_type_feedback_info(*info); |
| 369 } |
| 370 |
| 371 |
364 void FullCodeGenerator::PopulateTypeFeedbackCells(Handle<Code> code) { | 372 void FullCodeGenerator::PopulateTypeFeedbackCells(Handle<Code> code) { |
365 if (type_feedback_cells_.is_empty()) return; | 373 if (type_feedback_cells_.is_empty()) return; |
366 int length = type_feedback_cells_.length(); | 374 int length = type_feedback_cells_.length(); |
367 int array_size = TypeFeedbackCells::LengthOfFixedArray(length); | 375 int array_size = TypeFeedbackCells::LengthOfFixedArray(length); |
368 Handle<TypeFeedbackCells> cache = Handle<TypeFeedbackCells>::cast( | 376 Handle<TypeFeedbackCells> cache = Handle<TypeFeedbackCells>::cast( |
369 isolate()->factory()->NewFixedArray(array_size, TENURED)); | 377 isolate()->factory()->NewFixedArray(array_size, TENURED)); |
370 for (int i = 0; i < length; i++) { | 378 for (int i = 0; i < length; i++) { |
371 cache->SetAstId(i, Smi::FromInt(type_feedback_cells_[i].ast_id)); | 379 cache->SetAstId(i, Smi::FromInt(type_feedback_cells_[i].ast_id)); |
372 cache->SetCell(i, *type_feedback_cells_[i].cell); | 380 cache->SetCell(i, *type_feedback_cells_[i].cell); |
373 } | 381 } |
374 code->set_type_feedback_cells(*cache); | 382 TypeFeedbackInfo::cast(code->type_feedback_info())->set_type_feedback_cells( |
| 383 *cache); |
375 } | 384 } |
376 | 385 |
377 | 386 |
378 | 387 |
379 void FullCodeGenerator::PrepareForBailout(Expression* node, State state) { | 388 void FullCodeGenerator::PrepareForBailout(Expression* node, State state) { |
380 PrepareForBailoutForId(node->id(), state); | 389 PrepareForBailoutForId(node->id(), state); |
381 } | 390 } |
382 | 391 |
383 | 392 |
384 void FullCodeGenerator::RecordJSReturnSite(Call* call) { | 393 void FullCodeGenerator::RecordJSReturnSite(Call* call) { |
(...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1381 } | 1390 } |
1382 | 1391 |
1383 return false; | 1392 return false; |
1384 } | 1393 } |
1385 | 1394 |
1386 | 1395 |
1387 #undef __ | 1396 #undef __ |
1388 | 1397 |
1389 | 1398 |
1390 } } // namespace v8::internal | 1399 } } // namespace v8::internal |
OLD | NEW |