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

Side by Side Diff: src/hydrogen.cc

Issue 14403015: Disallow dereferencing deferred handles when generating optimized code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 7 years, 8 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/handles-inl.h ('k') | src/hydrogen-instructions.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 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 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 } 502 }
503 503
504 int visited_count_; 504 int visited_count_;
505 ZoneList<HBasicBlock*> stack_; 505 ZoneList<HBasicBlock*> stack_;
506 BitVector reachable_; 506 BitVector reachable_;
507 HBasicBlock* dont_visit_; 507 HBasicBlock* dont_visit_;
508 }; 508 };
509 509
510 510
511 void HGraph::Verify(bool do_full_verify) const { 511 void HGraph::Verify(bool do_full_verify) const {
512 // Allow dereferencing for debug mode verification. 512 ALLOW_HANDLE_DEREF(isolate(), "debug mode verification");
513 HandleDereferenceGuard allow_handle_deref(isolate(),
514 HandleDereferenceGuard::ALLOW);
515 for (int i = 0; i < blocks_.length(); i++) { 513 for (int i = 0; i < blocks_.length(); i++) {
516 HBasicBlock* block = blocks_.at(i); 514 HBasicBlock* block = blocks_.at(i);
517 515
518 block->Verify(); 516 block->Verify();
519 517
520 // Check that every block contains at least one node and that only the last 518 // Check that every block contains at least one node and that only the last
521 // node is a control instruction. 519 // node is a control instruction.
522 HInstruction* current = block->first(); 520 HInstruction* current = block->first();
523 ASSERT(current != NULL && current->IsBlockEntry()); 521 ASSERT(current != NULL && current->IsBlockEntry());
524 while (current != NULL) { 522 while (current != NULL) {
(...skipping 5816 matching lines...) Expand 10 before | Expand all | Expand 10 after
6341 Handle<JSObject> boilerplate_object = 6339 Handle<JSObject> boilerplate_object =
6342 DeepCopy(original_boilerplate_object); 6340 DeepCopy(original_boilerplate_object);
6343 6341
6344 literal = BuildFastLiteral(context, 6342 literal = BuildFastLiteral(context,
6345 boilerplate_object, 6343 boilerplate_object,
6346 original_boilerplate_object, 6344 original_boilerplate_object,
6347 data_size, 6345 data_size,
6348 pointer_size, 6346 pointer_size,
6349 DONT_TRACK_ALLOCATION_SITE); 6347 DONT_TRACK_ALLOCATION_SITE);
6350 } else { 6348 } else {
6349 Handle<FixedArray> closure_literals(closure->literals(), isolate());
6351 literal = AddInstruction( 6350 literal = AddInstruction(
6352 new(zone()) HObjectLiteral(context, 6351 new(zone()) HObjectLiteral(context,
6353 expr->constant_properties(), 6352 expr->constant_properties(),
6353 closure_literals,
6354 expr->fast_elements(), 6354 expr->fast_elements(),
6355 expr->literal_index(), 6355 expr->literal_index(),
6356 expr->depth(), 6356 expr->depth(),
6357 expr->has_function())); 6357 expr->has_function()));
6358 } 6358 }
6359 6359
6360 // The object is expected in the bailout environment during computation 6360 // The object is expected in the bailout environment during computation
6361 // of the property values and is the value of the entire expression. 6361 // of the property values and is the value of the entire expression.
6362 Push(literal); 6362 Push(literal);
6363 6363
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
6432 6432
6433 void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) { 6433 void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
6434 ASSERT(!HasStackOverflow()); 6434 ASSERT(!HasStackOverflow());
6435 ASSERT(current_block() != NULL); 6435 ASSERT(current_block() != NULL);
6436 ASSERT(current_block()->HasPredecessor()); 6436 ASSERT(current_block()->HasPredecessor());
6437 ZoneList<Expression*>* subexprs = expr->values(); 6437 ZoneList<Expression*>* subexprs = expr->values();
6438 int length = subexprs->length(); 6438 int length = subexprs->length();
6439 HValue* context = environment()->LookupContext(); 6439 HValue* context = environment()->LookupContext();
6440 HInstruction* literal; 6440 HInstruction* literal;
6441 6441
6442 Handle<FixedArray> literals(environment()->closure()->literals()); 6442 Handle<FixedArray> literals(environment()->closure()->literals(), isolate());
6443 Handle<Object> raw_boilerplate(literals->get(expr->literal_index()), 6443 Handle<Object> raw_boilerplate(literals->get(expr->literal_index()),
6444 isolate()); 6444 isolate());
6445 6445
6446 if (raw_boilerplate->IsUndefined()) { 6446 if (raw_boilerplate->IsUndefined()) {
6447 raw_boilerplate = Runtime::CreateArrayLiteralBoilerplate( 6447 raw_boilerplate = Runtime::CreateArrayLiteralBoilerplate(
6448 isolate(), literals, expr->constant_elements()); 6448 isolate(), literals, expr->constant_elements());
6449 if (raw_boilerplate.is_null()) { 6449 if (raw_boilerplate.is_null()) {
6450 return Bailout("array boilerplate creation failed"); 6450 return Bailout("array boilerplate creation failed");
6451 } 6451 }
6452 literals->set(expr->literal_index(), *raw_boilerplate); 6452 literals->set(expr->literal_index(), *raw_boilerplate);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
6484 literal = BuildFastLiteral(context, 6484 literal = BuildFastLiteral(context,
6485 boilerplate_object, 6485 boilerplate_object,
6486 original_boilerplate_object, 6486 original_boilerplate_object,
6487 data_size, 6487 data_size,
6488 pointer_size, 6488 pointer_size,
6489 mode); 6489 mode);
6490 } else { 6490 } else {
6491 literal = AddInstruction( 6491 literal = AddInstruction(
6492 new(zone()) HArrayLiteral(context, 6492 new(zone()) HArrayLiteral(context,
6493 original_boilerplate_object, 6493 original_boilerplate_object,
6494 literals,
6494 length, 6495 length,
6495 expr->literal_index(), 6496 expr->literal_index(),
6496 expr->depth(), 6497 expr->depth(),
6497 mode)); 6498 mode));
6498 } 6499 }
6499 6500
6500 // The array is expected in the bailout environment during computation 6501 // The array is expected in the bailout environment during computation
6501 // of the property values and is the value of the entire expression. 6502 // of the property values and is the value of the entire expression.
6502 Push(literal); 6503 Push(literal);
6503 6504
(...skipping 4945 matching lines...) Expand 10 before | Expand all | Expand 10 after
11449 CodeStub::Major major_key = info->code_stub()->MajorKey(); 11450 CodeStub::Major major_key = info->code_stub()->MajorKey();
11450 PrintStringProperty("name", CodeStub::MajorName(major_key, false)); 11451 PrintStringProperty("name", CodeStub::MajorName(major_key, false));
11451 PrintStringProperty("method", "stub"); 11452 PrintStringProperty("method", "stub");
11452 } 11453 }
11453 PrintLongProperty("date", static_cast<int64_t>(OS::TimeCurrentMillis())); 11454 PrintLongProperty("date", static_cast<int64_t>(OS::TimeCurrentMillis()));
11454 } 11455 }
11455 11456
11456 11457
11457 void HTracer::TraceLithium(const char* name, LChunk* chunk) { 11458 void HTracer::TraceLithium(const char* name, LChunk* chunk) {
11458 ASSERT(!FLAG_parallel_recompilation); 11459 ASSERT(!FLAG_parallel_recompilation);
11459 HandleDereferenceGuard allow_handle_deref(chunk->isolate(), 11460 ALLOW_HANDLE_DEREF(chunk->isolate(), "debug output");
11460 HandleDereferenceGuard::ALLOW);
11461 Trace(name, chunk->graph(), chunk); 11461 Trace(name, chunk->graph(), chunk);
11462 } 11462 }
11463 11463
11464 11464
11465 void HTracer::TraceHydrogen(const char* name, HGraph* graph) { 11465 void HTracer::TraceHydrogen(const char* name, HGraph* graph) {
11466 ASSERT(!FLAG_parallel_recompilation); 11466 ASSERT(!FLAG_parallel_recompilation);
11467 HandleDereferenceGuard allow_handle_deref(graph->isolate(), 11467 ALLOW_HANDLE_DEREF(graph->isolate(), "debug output");
11468 HandleDereferenceGuard::ALLOW);
11469 Trace(name, graph, NULL); 11468 Trace(name, graph, NULL);
11470 } 11469 }
11471 11470
11472 11471
11473 void HTracer::Trace(const char* name, HGraph* graph, LChunk* chunk) { 11472 void HTracer::Trace(const char* name, HGraph* graph, LChunk* chunk) {
11474 Tag tag(this, "cfg"); 11473 Tag tag(this, "cfg");
11475 PrintStringProperty("name", name); 11474 PrintStringProperty("name", name);
11476 const ZoneList<HBasicBlock*>* blocks = graph->blocks(); 11475 const ZoneList<HBasicBlock*>* blocks = graph->blocks();
11477 for (int i = 0; i < blocks->length(); i++) { 11476 for (int i = 0; i < blocks->length(); i++) {
11478 HBasicBlock* current = blocks->at(i); 11477 HBasicBlock* current = blocks->at(i);
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
11809 } 11808 }
11810 } 11809 }
11811 11810
11812 #ifdef DEBUG 11811 #ifdef DEBUG
11813 if (graph_ != NULL) graph_->Verify(false); // No full verify. 11812 if (graph_ != NULL) graph_->Verify(false); // No full verify.
11814 if (allocator_ != NULL) allocator_->Verify(); 11813 if (allocator_ != NULL) allocator_->Verify();
11815 #endif 11814 #endif
11816 } 11815 }
11817 11816
11818 } } // namespace v8::internal 11817 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/handles-inl.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698