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

Side by Side Diff: runtime/vm/code_generator_ia32.cc

Issue 8318002: Fix 5442338: Return true if the pc descriptor verifier skips verification because of too many des... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 2 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/code_generator.h" 8 #include "vm/code_generator.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 // - No two deopt descriptors have the same node id (deoptimization). 349 // - No two deopt descriptors have the same node id (deoptimization).
350 // - No two ic-call descriptors have the same node id (type feedback). 350 // - No two ic-call descriptors have the same node id (type feedback).
351 // - No two descriptors of same kind have the same PC. 351 // - No two descriptors of same kind have the same PC.
352 // A function without unique ids is marked as non-optimizable (e.g., because of 352 // A function without unique ids is marked as non-optimizable (e.g., because of
353 // finally blocks). 353 // finally blocks).
354 static bool VerifyPcDescriptors(const PcDescriptors& descriptors, 354 static bool VerifyPcDescriptors(const PcDescriptors& descriptors,
355 bool check_ids) { 355 bool check_ids) {
356 #if defined(DEBUG) 356 #if defined(DEBUG)
357 // TODO(srdjan): Implement a more efficient way to check, currently drop 357 // TODO(srdjan): Implement a more efficient way to check, currently drop
358 // the check for too large number of descriptors. 358 // the check for too large number of descriptors.
359 if (descriptors.Length() > 1000) { 359 if (descriptors.Length() > 3000) {
360 if (FLAG_trace_compiler) { 360 if (FLAG_trace_compiler) {
361 OS::Print("Not checking pc decriptors, length %d\n", 361 OS::Print("Not checking pc decriptors, length %d\n",
362 descriptors.Length()); 362 descriptors.Length());
363 } 363 }
364 return false; 364 return true;
ngeoffray 2011/10/17 12:19:04 Do you actually need the return now that the metho
srdjan 2011/10/17 12:23:48 Remove return, use ASSERTS as already implemented.
365 } 365 }
366 for (intptr_t i = 0; i < descriptors.Length(); i++) { 366 for (intptr_t i = 0; i < descriptors.Length(); i++) {
367 intptr_t pc = descriptors.PC(i); 367 intptr_t pc = descriptors.PC(i);
368 PcDescriptors::Kind kind = descriptors.DescriptorKind(i); 368 PcDescriptors::Kind kind = descriptors.DescriptorKind(i);
369 // 'node_id' is set for kDeopt and kIcCall and must be unique for one kind. 369 // 'node_id' is set for kDeopt and kIcCall and must be unique for one kind.
370 intptr_t node_id = AstNode::kInvalidId; 370 intptr_t node_id = AstNode::kInvalidId;
371 if (check_ids) { 371 if (check_ids) {
372 if ((descriptors.DescriptorKind(i) == PcDescriptors::kDeopt) || 372 if ((descriptors.DescriptorKind(i) == PcDescriptors::kDeopt) ||
373 (descriptors.DescriptorKind(i) == PcDescriptors::kIcCall)) { 373 (descriptors.DescriptorKind(i) == PcDescriptors::kIcCall)) {
374 node_id = descriptors.NodeId(i); 374 node_id = descriptors.NodeId(i);
(...skipping 12 matching lines...) Expand all
387 return true; 387 return true;
388 } 388 }
389 389
390 390
391 void CodeGenerator::FinalizePcDescriptors(const Code& code) { 391 void CodeGenerator::FinalizePcDescriptors(const Code& code) {
392 ASSERT(pc_descriptors_list_ != NULL); 392 ASSERT(pc_descriptors_list_ != NULL);
393 const PcDescriptors& descriptors = PcDescriptors::Handle( 393 const PcDescriptors& descriptors = PcDescriptors::Handle(
394 pc_descriptors_list_->FinalizePcDescriptors(code.EntryPoint())); 394 pc_descriptors_list_->FinalizePcDescriptors(code.EntryPoint()));
395 bool ok = VerifyPcDescriptors( 395 bool ok = VerifyPcDescriptors(
396 descriptors, parsed_function_.function().is_optimizable()); 396 descriptors, parsed_function_.function().is_optimizable());
397 if (!ok) { 397 ASSERT(ok);
398 // TODO(5442338) Fix bad pc descriptor generation.
399 parsed_function_.function().set_is_optimizable(false);
400 }
401 code.set_pc_descriptors(descriptors); 398 code.set_pc_descriptors(descriptors);
402 } 399 }
403 400
404 401
405 void CodeGenerator::FinalizeExceptionHandlers(const Code& code) { 402 void CodeGenerator::FinalizeExceptionHandlers(const Code& code) {
406 ASSERT(exception_handlers_list_ != NULL); 403 ASSERT(exception_handlers_list_ != NULL);
407 const ExceptionHandlers& handlers = ExceptionHandlers::Handle( 404 const ExceptionHandlers& handlers = ExceptionHandlers::Handle(
408 exception_handlers_list_->FinalizeExceptionHandlers(code.EntryPoint())); 405 exception_handlers_list_->FinalizeExceptionHandlers(code.EntryPoint()));
409 code.set_exception_handlers(handlers); 406 code.set_exception_handlers(handlers);
410 } 407 }
(...skipping 2248 matching lines...) Expand 10 before | Expand all | Expand 10 after
2659 const Class& cls = Class::Handle(parsed_function_.function().owner()); 2656 const Class& cls = Class::Handle(parsed_function_.function().owner());
2660 const Script& script = Script::Handle(cls.script()); 2657 const Script& script = Script::Handle(cls.script());
2661 Parser::ReportMsg(script, token_index, "Error", error_msg, format, args); 2658 Parser::ReportMsg(script, token_index, "Error", error_msg, format, args);
2662 Isolate::Current()->long_jump_base()->Jump(1, error_msg); 2659 Isolate::Current()->long_jump_base()->Jump(1, error_msg);
2663 UNREACHABLE(); 2660 UNREACHABLE();
2664 } 2661 }
2665 2662
2666 } // namespace dart 2663 } // namespace dart
2667 2664
2668 #endif // defined TARGET_ARCH_IA32 2665 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698