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 6531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6542 | 6542 |
6543 | 6543 |
6544 void HGraphBuilder::EnsureArgumentsArePushedForAccess() { | 6544 void HGraphBuilder::EnsureArgumentsArePushedForAccess() { |
6545 // Outermost function already has arguments on the stack. | 6545 // Outermost function already has arguments on the stack. |
6546 if (function_state()->outer() == NULL) return; | 6546 if (function_state()->outer() == NULL) return; |
6547 | 6547 |
6548 if (function_state()->arguments_pushed()) return; | 6548 if (function_state()->arguments_pushed()) return; |
6549 | 6549 |
6550 // Push arguments when entering inlined function. | 6550 // Push arguments when entering inlined function. |
6551 HEnterInlined* entry = function_state()->entry(); | 6551 HEnterInlined* entry = function_state()->entry(); |
| 6552 entry->set_arguments_pushed(); |
6552 | 6553 |
6553 ZoneList<HValue*>* arguments_values = entry->arguments_values(); | 6554 ZoneList<HValue*>* arguments_values = entry->arguments_values(); |
6554 | 6555 |
6555 HInstruction* insert_after = entry; | 6556 HInstruction* insert_after = entry; |
6556 for (int i = 0; i < arguments_values->length(); i++) { | 6557 for (int i = 0; i < arguments_values->length(); i++) { |
6557 HValue* argument = arguments_values->at(i); | 6558 HValue* argument = arguments_values->at(i); |
6558 HInstruction* push_argument = new(zone()) HPushArgument(argument); | 6559 HInstruction* push_argument = new(zone()) HPushArgument(argument); |
6559 push_argument->InsertAfter(insert_after); | 6560 push_argument->InsertAfter(insert_after); |
6560 insert_after = push_argument; | 6561 insert_after = push_argument; |
6561 } | 6562 } |
(...skipping 2822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9384 Handle<JSFunction> closure, | 9385 Handle<JSFunction> closure, |
9385 Zone* zone) | 9386 Zone* zone) |
9386 : closure_(closure), | 9387 : closure_(closure), |
9387 values_(0, zone), | 9388 values_(0, zone), |
9388 assigned_variables_(4, zone), | 9389 assigned_variables_(4, zone), |
9389 frame_type_(JS_FUNCTION), | 9390 frame_type_(JS_FUNCTION), |
9390 parameter_count_(0), | 9391 parameter_count_(0), |
9391 specials_count_(1), | 9392 specials_count_(1), |
9392 local_count_(0), | 9393 local_count_(0), |
9393 outer_(outer), | 9394 outer_(outer), |
| 9395 entry_(NULL), |
9394 pop_count_(0), | 9396 pop_count_(0), |
9395 push_count_(0), | 9397 push_count_(0), |
9396 ast_id_(BailoutId::None()), | 9398 ast_id_(BailoutId::None()), |
9397 zone_(zone) { | 9399 zone_(zone) { |
9398 Initialize(scope->num_parameters() + 1, scope->num_stack_slots(), 0); | 9400 Initialize(scope->num_parameters() + 1, scope->num_stack_slots(), 0); |
9399 } | 9401 } |
9400 | 9402 |
9401 | 9403 |
9402 HEnvironment::HEnvironment(const HEnvironment* other, Zone* zone) | 9404 HEnvironment::HEnvironment(const HEnvironment* other, Zone* zone) |
9403 : values_(0, zone), | 9405 : values_(0, zone), |
9404 assigned_variables_(0, zone), | 9406 assigned_variables_(0, zone), |
9405 frame_type_(JS_FUNCTION), | 9407 frame_type_(JS_FUNCTION), |
9406 parameter_count_(0), | 9408 parameter_count_(0), |
9407 specials_count_(1), | 9409 specials_count_(1), |
9408 local_count_(0), | 9410 local_count_(0), |
9409 outer_(NULL), | 9411 outer_(NULL), |
| 9412 entry_(NULL), |
9410 pop_count_(0), | 9413 pop_count_(0), |
9411 push_count_(0), | 9414 push_count_(0), |
9412 ast_id_(other->ast_id()), | 9415 ast_id_(other->ast_id()), |
9413 zone_(zone) { | 9416 zone_(zone) { |
9414 Initialize(other); | 9417 Initialize(other); |
9415 } | 9418 } |
9416 | 9419 |
9417 | 9420 |
9418 HEnvironment::HEnvironment(HEnvironment* outer, | 9421 HEnvironment::HEnvironment(HEnvironment* outer, |
9419 Handle<JSFunction> closure, | 9422 Handle<JSFunction> closure, |
9420 FrameType frame_type, | 9423 FrameType frame_type, |
9421 int arguments, | 9424 int arguments, |
9422 Zone* zone) | 9425 Zone* zone) |
9423 : closure_(closure), | 9426 : closure_(closure), |
9424 values_(arguments, zone), | 9427 values_(arguments, zone), |
9425 assigned_variables_(0, zone), | 9428 assigned_variables_(0, zone), |
9426 frame_type_(frame_type), | 9429 frame_type_(frame_type), |
9427 parameter_count_(arguments), | 9430 parameter_count_(arguments), |
9428 local_count_(0), | 9431 local_count_(0), |
9429 outer_(outer), | 9432 outer_(outer), |
| 9433 entry_(NULL), |
9430 pop_count_(0), | 9434 pop_count_(0), |
9431 push_count_(0), | 9435 push_count_(0), |
9432 ast_id_(BailoutId::None()), | 9436 ast_id_(BailoutId::None()), |
9433 zone_(zone) { | 9437 zone_(zone) { |
9434 } | 9438 } |
9435 | 9439 |
9436 | 9440 |
9437 void HEnvironment::Initialize(int parameter_count, | 9441 void HEnvironment::Initialize(int parameter_count, |
9438 int local_count, | 9442 int local_count, |
9439 int stack_height) { | 9443 int stack_height) { |
9440 parameter_count_ = parameter_count; | 9444 parameter_count_ = parameter_count; |
9441 local_count_ = local_count; | 9445 local_count_ = local_count; |
9442 | 9446 |
9443 // Avoid reallocating the temporaries' backing store on the first Push. | 9447 // Avoid reallocating the temporaries' backing store on the first Push. |
9444 int total = parameter_count + specials_count_ + local_count + stack_height; | 9448 int total = parameter_count + specials_count_ + local_count + stack_height; |
9445 values_.Initialize(total + 4, zone()); | 9449 values_.Initialize(total + 4, zone()); |
9446 for (int i = 0; i < total; ++i) values_.Add(NULL, zone()); | 9450 for (int i = 0; i < total; ++i) values_.Add(NULL, zone()); |
9447 } | 9451 } |
9448 | 9452 |
9449 | 9453 |
9450 void HEnvironment::Initialize(const HEnvironment* other) { | 9454 void HEnvironment::Initialize(const HEnvironment* other) { |
9451 closure_ = other->closure(); | 9455 closure_ = other->closure(); |
9452 values_.AddAll(other->values_, zone()); | 9456 values_.AddAll(other->values_, zone()); |
9453 assigned_variables_.AddAll(other->assigned_variables_, zone()); | 9457 assigned_variables_.AddAll(other->assigned_variables_, zone()); |
9454 frame_type_ = other->frame_type_; | 9458 frame_type_ = other->frame_type_; |
9455 parameter_count_ = other->parameter_count_; | 9459 parameter_count_ = other->parameter_count_; |
9456 local_count_ = other->local_count_; | 9460 local_count_ = other->local_count_; |
9457 if (other->outer_ != NULL) outer_ = other->outer_->Copy(); // Deep copy. | 9461 if (other->outer_ != NULL) outer_ = other->outer_->Copy(); // Deep copy. |
| 9462 entry_ = other->entry_; |
9458 pop_count_ = other->pop_count_; | 9463 pop_count_ = other->pop_count_; |
9459 push_count_ = other->push_count_; | 9464 push_count_ = other->push_count_; |
9460 ast_id_ = other->ast_id_; | 9465 ast_id_ = other->ast_id_; |
9461 } | 9466 } |
9462 | 9467 |
9463 | 9468 |
9464 void HEnvironment::AddIncomingEdge(HBasicBlock* block, HEnvironment* other) { | 9469 void HEnvironment::AddIncomingEdge(HBasicBlock* block, HEnvironment* other) { |
9465 ASSERT(!block->IsLoopHeader()); | 9470 ASSERT(!block->IsLoopHeader()); |
9466 ASSERT(values_.length() == other->values_.length()); | 9471 ASSERT(values_.length() == other->values_.length()); |
9467 | 9472 |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9976 } | 9981 } |
9977 } | 9982 } |
9978 | 9983 |
9979 #ifdef DEBUG | 9984 #ifdef DEBUG |
9980 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 9985 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
9981 if (allocator_ != NULL) allocator_->Verify(); | 9986 if (allocator_ != NULL) allocator_->Verify(); |
9982 #endif | 9987 #endif |
9983 } | 9988 } |
9984 | 9989 |
9985 } } // namespace v8::internal | 9990 } } // namespace v8::internal |
OLD | NEW |