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

Side by Side Diff: src/hydrogen.cc

Issue 12300018: Made Isolate a mandatory parameter for everything Handle-related. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Even less Isolate::Current Created 7 years, 10 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
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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 493
494 int visited_count_; 494 int visited_count_;
495 ZoneList<HBasicBlock*> stack_; 495 ZoneList<HBasicBlock*> stack_;
496 BitVector reachable_; 496 BitVector reachable_;
497 HBasicBlock* dont_visit_; 497 HBasicBlock* dont_visit_;
498 }; 498 };
499 499
500 500
501 void HGraph::Verify(bool do_full_verify) const { 501 void HGraph::Verify(bool do_full_verify) const {
502 // Allow dereferencing for debug mode verification. 502 // Allow dereferencing for debug mode verification.
503 AllowHandleDereference allow_handle_deref; 503 AllowHandleDereference allow_handle_deref(isolate());
504 for (int i = 0; i < blocks_.length(); i++) { 504 for (int i = 0; i < blocks_.length(); i++) {
505 HBasicBlock* block = blocks_.at(i); 505 HBasicBlock* block = blocks_.at(i);
506 506
507 block->Verify(); 507 block->Verify();
508 508
509 // Check that every block contains at least one node and that only the last 509 // Check that every block contains at least one node and that only the last
510 // node is a control instruction. 510 // node is a control instruction.
511 HInstruction* current = block->first(); 511 HInstruction* current = block->first();
512 ASSERT(current != NULL && current->IsBlockEntry()); 512 ASSERT(current != NULL && current->IsBlockEntry());
513 while (current != NULL) { 513 while (current != NULL) {
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 if (mapcheck != NULL) { 918 if (mapcheck != NULL) {
919 mapcheck->ClearGVNFlag(kDependsOnElementsKind); 919 mapcheck->ClearGVNFlag(kDependsOnElementsKind);
920 } 920 }
921 } 921 }
922 bool fast_smi_only_elements = IsFastSmiElementsKind(elements_kind); 922 bool fast_smi_only_elements = IsFastSmiElementsKind(elements_kind);
923 bool fast_elements = IsFastObjectElementsKind(elements_kind); 923 bool fast_elements = IsFastObjectElementsKind(elements_kind);
924 HInstruction* elements = 924 HInstruction* elements =
925 AddInstruction(new(zone) HLoadElements(object, mapcheck)); 925 AddInstruction(new(zone) HLoadElements(object, mapcheck));
926 if (is_store && (fast_elements || fast_smi_only_elements)) { 926 if (is_store && (fast_elements || fast_smi_only_elements)) {
927 HCheckMaps* check_cow_map = new(zone) HCheckMaps( 927 HCheckMaps* check_cow_map = new(zone) HCheckMaps(
928 elements, Isolate::Current()->factory()->fixed_array_map(), zone); 928 elements, graph()->isolate()->factory()->fixed_array_map(), zone);
929 check_cow_map->ClearGVNFlag(kDependsOnElementsKind); 929 check_cow_map->ClearGVNFlag(kDependsOnElementsKind);
930 AddInstruction(check_cow_map); 930 AddInstruction(check_cow_map);
931 } 931 }
932 HInstruction* length = NULL; 932 HInstruction* length = NULL;
933 HInstruction* checked_key = NULL; 933 HInstruction* checked_key = NULL;
934 if (IsExternalArrayElementsKind(elements_kind)) { 934 if (IsExternalArrayElementsKind(elements_kind)) {
935 length = AddInstruction(new(zone) HFixedArrayBaseLength(elements)); 935 length = AddInstruction(new(zone) HFixedArrayBaseLength(elements));
936 checked_key = AddBoundsCheck( 936 checked_key = AddBoundsCheck(
937 key, length, ALLOW_SMI_KEY, checked_index_representation); 937 key, length, ALLOW_SMI_KEY, checked_index_representation);
938 HLoadExternalArrayPointer* external_elements = 938 HLoadExternalArrayPointer* external_elements =
(...skipping 4188 matching lines...) Expand 10 before | Expand all | Expand 10 after
5127 5127
5128 HInstruction* array = AddInstruction( 5128 HInstruction* array = AddInstruction(
5129 new(zone()) HForInCacheArray( 5129 new(zone()) HForInCacheArray(
5130 enumerable, 5130 enumerable,
5131 map, 5131 map,
5132 DescriptorArray::kEnumCacheBridgeCacheIndex)); 5132 DescriptorArray::kEnumCacheBridgeCacheIndex));
5133 5133
5134 HInstruction* enum_length = AddInstruction(new(zone()) HMapEnumLength(map)); 5134 HInstruction* enum_length = AddInstruction(new(zone()) HMapEnumLength(map));
5135 5135
5136 HInstruction* start_index = AddInstruction(new(zone()) HConstant( 5136 HInstruction* start_index = AddInstruction(new(zone()) HConstant(
5137 Handle<Object>(Smi::FromInt(0)), Representation::Integer32())); 5137 Handle<Object>(Smi::FromInt(0), isolate()), Representation::Integer32()));
5138 5138
5139 Push(map); 5139 Push(map);
5140 Push(array); 5140 Push(array);
5141 Push(enum_length); 5141 Push(enum_length);
5142 Push(start_index); 5142 Push(start_index);
5143 5143
5144 HInstruction* index_cache = AddInstruction( 5144 HInstruction* index_cache = AddInstruction(
5145 new(zone()) HForInCacheArray( 5145 new(zone()) HForInCacheArray(
5146 enumerable, 5146 enumerable,
5147 map, 5147 map,
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
5476 5476
5477 5477
5478 // Tries to find a JavaScript accessor of the given name in the prototype chain 5478 // Tries to find a JavaScript accessor of the given name in the prototype chain
5479 // starting at the given map. Return true iff there is one, including the 5479 // starting at the given map. Return true iff there is one, including the
5480 // corresponding AccessorPair plus its holder (which could be null when the 5480 // corresponding AccessorPair plus its holder (which could be null when the
5481 // accessor is found directly in the given map). 5481 // accessor is found directly in the given map).
5482 static bool LookupAccessorPair(Handle<Map> map, 5482 static bool LookupAccessorPair(Handle<Map> map,
5483 Handle<String> name, 5483 Handle<String> name,
5484 Handle<AccessorPair>* accessors, 5484 Handle<AccessorPair>* accessors,
5485 Handle<JSObject>* holder) { 5485 Handle<JSObject>* holder) {
5486 LookupResult lookup(map->GetIsolate()); 5486 Isolate* isolate = map->GetIsolate();
5487 LookupResult lookup(isolate);
5487 5488
5488 // Check for a JavaScript accessor directly in the map. 5489 // Check for a JavaScript accessor directly in the map.
5489 map->LookupDescriptor(NULL, *name, &lookup); 5490 map->LookupDescriptor(NULL, *name, &lookup);
5490 if (lookup.IsPropertyCallbacks()) { 5491 if (lookup.IsPropertyCallbacks()) {
5491 Handle<Object> callback(lookup.GetValueFromMap(*map)); 5492 Handle<Object> callback(lookup.GetValueFromMap(*map), isolate);
5492 if (!callback->IsAccessorPair()) return false; 5493 if (!callback->IsAccessorPair()) return false;
5493 *accessors = Handle<AccessorPair>::cast(callback); 5494 *accessors = Handle<AccessorPair>::cast(callback);
5494 *holder = Handle<JSObject>(); 5495 *holder = Handle<JSObject>();
5495 return true; 5496 return true;
5496 } 5497 }
5497 5498
5498 // Everything else, e.g. a field, can't be an accessor call. 5499 // Everything else, e.g. a field, can't be an accessor call.
5499 if (lookup.IsFound()) return false; 5500 if (lookup.IsFound()) return false;
5500 5501
5501 // Check for a JavaScript accessor somewhere in the proto chain. 5502 // Check for a JavaScript accessor somewhere in the proto chain.
5502 LookupInPrototypes(map, name, &lookup); 5503 LookupInPrototypes(map, name, &lookup);
5503 if (lookup.IsPropertyCallbacks()) { 5504 if (lookup.IsPropertyCallbacks()) {
5504 Handle<Object> callback(lookup.GetValue()); 5505 Handle<Object> callback(lookup.GetValue(), isolate);
5505 if (!callback->IsAccessorPair()) return false; 5506 if (!callback->IsAccessorPair()) return false;
5506 *accessors = Handle<AccessorPair>::cast(callback); 5507 *accessors = Handle<AccessorPair>::cast(callback);
5507 *holder = Handle<JSObject>(lookup.holder()); 5508 *holder = Handle<JSObject>(lookup.holder());
5508 return true; 5509 return true;
5509 } 5510 }
5510 5511
5511 // We haven't found a JavaScript accessor anywhere. 5512 // We haven't found a JavaScript accessor anywhere.
5512 return false; 5513 return false;
5513 } 5514 }
5514 5515
(...skipping 29 matching lines...) Expand all
5544 // Determines whether the given array or object literal boilerplate satisfies 5545 // Determines whether the given array or object literal boilerplate satisfies
5545 // all limits to be considered for fast deep-copying and computes the total 5546 // all limits to be considered for fast deep-copying and computes the total
5546 // size of all objects that are part of the graph. 5547 // size of all objects that are part of the graph.
5547 static bool IsFastLiteral(Handle<JSObject> boilerplate, 5548 static bool IsFastLiteral(Handle<JSObject> boilerplate,
5548 int max_depth, 5549 int max_depth,
5549 int* max_properties, 5550 int* max_properties,
5550 int* total_size) { 5551 int* total_size) {
5551 ASSERT(max_depth >= 0 && *max_properties >= 0); 5552 ASSERT(max_depth >= 0 && *max_properties >= 0);
5552 if (max_depth == 0) return false; 5553 if (max_depth == 0) return false;
5553 5554
5555 Isolate* isolate = boilerplate->GetIsolate();
5554 Handle<FixedArrayBase> elements(boilerplate->elements()); 5556 Handle<FixedArrayBase> elements(boilerplate->elements());
5555 if (elements->length() > 0 && 5557 if (elements->length() > 0 &&
5556 elements->map() != boilerplate->GetHeap()->fixed_cow_array_map()) { 5558 elements->map() != isolate->heap()->fixed_cow_array_map()) {
5557 if (boilerplate->HasFastDoubleElements()) { 5559 if (boilerplate->HasFastDoubleElements()) {
5558 *total_size += FixedDoubleArray::SizeFor(elements->length()); 5560 *total_size += FixedDoubleArray::SizeFor(elements->length());
5559 } else if (boilerplate->HasFastObjectElements()) { 5561 } else if (boilerplate->HasFastObjectElements()) {
5560 Handle<FixedArray> fast_elements = Handle<FixedArray>::cast(elements); 5562 Handle<FixedArray> fast_elements = Handle<FixedArray>::cast(elements);
5561 int length = elements->length(); 5563 int length = elements->length();
5562 for (int i = 0; i < length; i++) { 5564 for (int i = 0; i < length; i++) {
5563 if ((*max_properties)-- == 0) return false; 5565 if ((*max_properties)-- == 0) return false;
5564 Handle<Object> value(fast_elements->get(i)); 5566 Handle<Object> value(fast_elements->get(i), isolate);
5565 if (value->IsJSObject()) { 5567 if (value->IsJSObject()) {
5566 Handle<JSObject> value_object = Handle<JSObject>::cast(value); 5568 Handle<JSObject> value_object = Handle<JSObject>::cast(value);
5567 if (!IsFastLiteral(value_object, 5569 if (!IsFastLiteral(value_object,
5568 max_depth - 1, 5570 max_depth - 1,
5569 max_properties, 5571 max_properties,
5570 total_size)) { 5572 total_size)) {
5571 return false; 5573 return false;
5572 } 5574 }
5573 } 5575 }
5574 } 5576 }
5575 *total_size += FixedArray::SizeFor(length); 5577 *total_size += FixedArray::SizeFor(length);
5576 } else { 5578 } else {
5577 return false; 5579 return false;
5578 } 5580 }
5579 } 5581 }
5580 5582
5581 Handle<FixedArray> properties(boilerplate->properties()); 5583 Handle<FixedArray> properties(boilerplate->properties());
5582 if (properties->length() > 0) { 5584 if (properties->length() > 0) {
5583 return false; 5585 return false;
5584 } else { 5586 } else {
5585 int nof = boilerplate->map()->inobject_properties(); 5587 int nof = boilerplate->map()->inobject_properties();
5586 for (int i = 0; i < nof; i++) { 5588 for (int i = 0; i < nof; i++) {
5587 if ((*max_properties)-- == 0) return false; 5589 if ((*max_properties)-- == 0) return false;
5588 Handle<Object> value(boilerplate->InObjectPropertyAt(i)); 5590 Handle<Object> value(boilerplate->InObjectPropertyAt(i), isolate);
5589 if (value->IsJSObject()) { 5591 if (value->IsJSObject()) {
5590 Handle<JSObject> value_object = Handle<JSObject>::cast(value); 5592 Handle<JSObject> value_object = Handle<JSObject>::cast(value);
5591 if (!IsFastLiteral(value_object, 5593 if (!IsFastLiteral(value_object,
5592 max_depth - 1, 5594 max_depth - 1,
5593 max_properties, 5595 max_properties,
5594 total_size)) { 5596 total_size)) {
5595 return false; 5597 return false;
5596 } 5598 }
5597 } 5599 }
5598 } 5600 }
5599 } 5601 }
5600 5602
5601 *total_size += boilerplate->map()->instance_size(); 5603 *total_size += boilerplate->map()->instance_size();
5602 return true; 5604 return true;
5603 } 5605 }
5604 5606
5605 5607
5606 void HOptimizedGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { 5608 void HOptimizedGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
5607 ASSERT(!HasStackOverflow()); 5609 ASSERT(!HasStackOverflow());
5608 ASSERT(current_block() != NULL); 5610 ASSERT(current_block() != NULL);
5609 ASSERT(current_block()->HasPredecessor()); 5611 ASSERT(current_block()->HasPredecessor());
5610 Handle<JSFunction> closure = function_state()->compilation_info()->closure(); 5612 Handle<JSFunction> closure = function_state()->compilation_info()->closure();
5611 HValue* context = environment()->LookupContext(); 5613 HValue* context = environment()->LookupContext();
5612 HInstruction* literal; 5614 HInstruction* literal;
5613 5615
5614 // Check whether to use fast or slow deep-copying for boilerplate. 5616 // Check whether to use fast or slow deep-copying for boilerplate.
5615 int total_size = 0; 5617 int total_size = 0;
5616 int max_properties = HFastLiteral::kMaxLiteralProperties; 5618 int max_properties = HFastLiteral::kMaxLiteralProperties;
5617 Handle<Object> boilerplate(closure->literals()->get(expr->literal_index())); 5619 Handle<Object> boilerplate(closure->literals()->get(expr->literal_index()),
5620 isolate());
5618 if (boilerplate->IsJSObject() && 5621 if (boilerplate->IsJSObject() &&
5619 IsFastLiteral(Handle<JSObject>::cast(boilerplate), 5622 IsFastLiteral(Handle<JSObject>::cast(boilerplate),
5620 HFastLiteral::kMaxLiteralDepth, 5623 HFastLiteral::kMaxLiteralDepth,
5621 &max_properties, 5624 &max_properties,
5622 &total_size)) { 5625 &total_size)) {
5623 Handle<JSObject> boilerplate_object = Handle<JSObject>::cast(boilerplate); 5626 Handle<JSObject> boilerplate_object = Handle<JSObject>::cast(boilerplate);
5624 literal = new(zone()) HFastLiteral(context, 5627 literal = new(zone()) HFastLiteral(context,
5625 boilerplate_object, 5628 boilerplate_object,
5626 total_size, 5629 total_size,
5627 expr->literal_index(), 5630 expr->literal_index(),
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
5712 void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) { 5715 void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
5713 ASSERT(!HasStackOverflow()); 5716 ASSERT(!HasStackOverflow());
5714 ASSERT(current_block() != NULL); 5717 ASSERT(current_block() != NULL);
5715 ASSERT(current_block()->HasPredecessor()); 5718 ASSERT(current_block()->HasPredecessor());
5716 ZoneList<Expression*>* subexprs = expr->values(); 5719 ZoneList<Expression*>* subexprs = expr->values();
5717 int length = subexprs->length(); 5720 int length = subexprs->length();
5718 HValue* context = environment()->LookupContext(); 5721 HValue* context = environment()->LookupContext();
5719 HInstruction* literal; 5722 HInstruction* literal;
5720 5723
5721 Handle<FixedArray> literals(environment()->closure()->literals()); 5724 Handle<FixedArray> literals(environment()->closure()->literals());
5722 Handle<Object> raw_boilerplate(literals->get(expr->literal_index())); 5725 Handle<Object> raw_boilerplate(literals->get(expr->literal_index()),
5726 isolate());
5723 5727
5724 if (raw_boilerplate->IsUndefined()) { 5728 if (raw_boilerplate->IsUndefined()) {
5725 raw_boilerplate = Runtime::CreateArrayLiteralBoilerplate( 5729 raw_boilerplate = Runtime::CreateArrayLiteralBoilerplate(
5726 isolate(), literals, expr->constant_elements()); 5730 isolate(), literals, expr->constant_elements());
5727 if (raw_boilerplate.is_null()) { 5731 if (raw_boilerplate.is_null()) {
5728 return Bailout("array boilerplate creation failed"); 5732 return Bailout("array boilerplate creation failed");
5729 } 5733 }
5730 literals->set(expr->literal_index(), *raw_boilerplate); 5734 literals->set(expr->literal_index(), *raw_boilerplate);
5731 if (JSObject::cast(*raw_boilerplate)->elements()->map() == 5735 if (JSObject::cast(*raw_boilerplate)->elements()->map() ==
5732 isolate()->heap()->fixed_cow_array_map()) { 5736 isolate()->heap()->fixed_cow_array_map()) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
5784 CHECK_ALIVE(VisitForValue(subexpr)); 5788 CHECK_ALIVE(VisitForValue(subexpr));
5785 HValue* value = Pop(); 5789 HValue* value = Pop();
5786 if (!Smi::IsValid(i)) return Bailout("Non-smi key in array literal"); 5790 if (!Smi::IsValid(i)) return Bailout("Non-smi key in array literal");
5787 5791
5788 // Pass in literal as dummy depedency, since the receiver always has 5792 // Pass in literal as dummy depedency, since the receiver always has
5789 // elements. 5793 // elements.
5790 elements = new(zone()) HLoadElements(literal, literal); 5794 elements = new(zone()) HLoadElements(literal, literal);
5791 AddInstruction(elements); 5795 AddInstruction(elements);
5792 5796
5793 HValue* key = AddInstruction( 5797 HValue* key = AddInstruction(
5794 new(zone()) HConstant(Handle<Object>(Smi::FromInt(i)), 5798 new(zone()) HConstant(Handle<Object>(Smi::FromInt(i), isolate()),
5795 Representation::Integer32())); 5799 Representation::Integer32()));
5796 5800
5797 switch (boilerplate_elements_kind) { 5801 switch (boilerplate_elements_kind) {
5798 case FAST_SMI_ELEMENTS: 5802 case FAST_SMI_ELEMENTS:
5799 case FAST_HOLEY_SMI_ELEMENTS: 5803 case FAST_HOLEY_SMI_ELEMENTS:
5800 // Smi-only arrays need a smi check. 5804 // Smi-only arrays need a smi check.
5801 AddInstruction(new(zone()) HCheckSmi(value)); 5805 AddInstruction(new(zone()) HCheckSmi(value));
5802 // Fall through. 5806 // Fall through.
5803 case FAST_ELEMENTS: 5807 case FAST_ELEMENTS:
5804 case FAST_HOLEY_ELEMENTS: 5808 case FAST_HOLEY_ELEMENTS:
(...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after
7044 7048
7045 if (function_state()->outer() == NULL) { 7049 if (function_state()->outer() == NULL) {
7046 HInstruction* elements = AddInstruction( 7050 HInstruction* elements = AddInstruction(
7047 new(zone()) HArgumentsElements(false)); 7051 new(zone()) HArgumentsElements(false));
7048 result = new(zone()) HArgumentsLength(elements); 7052 result = new(zone()) HArgumentsLength(elements);
7049 } else { 7053 } else {
7050 // Number of arguments without receiver. 7054 // Number of arguments without receiver.
7051 int argument_count = environment()-> 7055 int argument_count = environment()->
7052 arguments_environment()->parameter_count() - 1; 7056 arguments_environment()->parameter_count() - 1;
7053 result = new(zone()) HConstant( 7057 result = new(zone()) HConstant(
7054 Handle<Object>(Smi::FromInt(argument_count)), 7058 Handle<Object>(Smi::FromInt(argument_count), isolate()),
7055 Representation::Integer32()); 7059 Representation::Integer32());
7056 } 7060 }
7057 } else { 7061 } else {
7058 Push(graph()->GetArgumentsObject()); 7062 Push(graph()->GetArgumentsObject());
7059 VisitForValue(expr->key()); 7063 VisitForValue(expr->key());
7060 if (HasStackOverflow() || current_block() == NULL) return true; 7064 if (HasStackOverflow() || current_block() == NULL) return true;
7061 HValue* key = Pop(); 7065 HValue* key = Pop();
7062 Drop(1); // Arguments object. 7066 Drop(1); // Arguments object.
7063 if (function_state()->outer() == NULL) { 7067 if (function_state()->outer() == NULL) {
7064 HInstruction* elements = AddInstruction( 7068 HInstruction* elements = AddInstruction(
7065 new(zone()) HArgumentsElements(false)); 7069 new(zone()) HArgumentsElements(false));
7066 HInstruction* length = AddInstruction( 7070 HInstruction* length = AddInstruction(
7067 new(zone()) HArgumentsLength(elements)); 7071 new(zone()) HArgumentsLength(elements));
7068 HInstruction* checked_key = AddBoundsCheck(key, length); 7072 HInstruction* checked_key = AddBoundsCheck(key, length);
7069 result = new(zone()) HAccessArgumentsAt(elements, length, checked_key); 7073 result = new(zone()) HAccessArgumentsAt(elements, length, checked_key);
7070 } else { 7074 } else {
7071 EnsureArgumentsArePushedForAccess(); 7075 EnsureArgumentsArePushedForAccess();
7072 7076
7073 // Number of arguments without receiver. 7077 // Number of arguments without receiver.
7074 HInstruction* elements = function_state()->arguments_elements(); 7078 HInstruction* elements = function_state()->arguments_elements();
7075 int argument_count = environment()-> 7079 int argument_count = environment()->
7076 arguments_environment()->parameter_count() - 1; 7080 arguments_environment()->parameter_count() - 1;
7077 HInstruction* length = AddInstruction(new(zone()) HConstant( 7081 HInstruction* length = AddInstruction(new(zone()) HConstant(
7078 Handle<Object>(Smi::FromInt(argument_count)), 7082 Handle<Object>(Smi::FromInt(argument_count), isolate()),
7079 Representation::Integer32())); 7083 Representation::Integer32()));
Michael Starzinger 2013/02/25 10:50:58 Indentation of third line is off.
Sven Panne 2013/02/25 14:44:43 Done.
7080 HInstruction* checked_key = AddBoundsCheck(key, length); 7084 HInstruction* checked_key = AddBoundsCheck(key, length);
7081 result = new(zone()) HAccessArgumentsAt(elements, length, checked_key); 7085 result = new(zone()) HAccessArgumentsAt(elements, length, checked_key);
7082 } 7086 }
7083 } 7087 }
7084 ast_context()->ReturnInstruction(result, expr->id()); 7088 ast_context()->ReturnInstruction(result, expr->id());
7085 return true; 7089 return true;
7086 } 7090 }
7087 7091
7088 7092
7089 void HOptimizedGraphBuilder::VisitProperty(Property* expr) { 7093 void HOptimizedGraphBuilder::VisitProperty(Property* expr) {
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
7879 HValue* context = environment()->LookupContext(); 7883 HValue* context = environment()->LookupContext();
7880 HInstruction* result = NULL; 7884 HInstruction* result = NULL;
7881 // Use sqrt() if exponent is 0.5 or -0.5. 7885 // Use sqrt() if exponent is 0.5 or -0.5.
7882 if (right->IsConstant() && HConstant::cast(right)->HasDoubleValue()) { 7886 if (right->IsConstant() && HConstant::cast(right)->HasDoubleValue()) {
7883 double exponent = HConstant::cast(right)->DoubleValue(); 7887 double exponent = HConstant::cast(right)->DoubleValue();
7884 if (exponent == 0.5) { 7888 if (exponent == 0.5) {
7885 result = 7889 result =
7886 new(zone()) HUnaryMathOperation(context, left, kMathPowHalf); 7890 new(zone()) HUnaryMathOperation(context, left, kMathPowHalf);
7887 } else if (exponent == -0.5) { 7891 } else if (exponent == -0.5) {
7888 HConstant* double_one = 7892 HConstant* double_one =
7889 new(zone()) HConstant(Handle<Object>(Smi::FromInt(1)), 7893 new(zone()) HConstant(Handle<Object>(Smi::FromInt(1),
7894 isolate()),
7890 Representation::Double()); 7895 Representation::Double());
7891 AddInstruction(double_one); 7896 AddInstruction(double_one);
7892 HUnaryMathOperation* square_root = 7897 HUnaryMathOperation* square_root =
7893 new(zone()) HUnaryMathOperation(context, left, kMathPowHalf); 7898 new(zone()) HUnaryMathOperation(context, left, kMathPowHalf);
7894 AddInstruction(square_root); 7899 AddInstruction(square_root);
7895 // MathPowHalf doesn't have side effects so there's no need for 7900 // MathPowHalf doesn't have side effects so there's no need for
7896 // an environment simulation here. 7901 // an environment simulation here.
7897 ASSERT(!square_root->HasObservableSideEffects()); 7902 ASSERT(!square_root->HasObservableSideEffects());
7898 result = new(zone()) HDiv(context, double_one, square_root); 7903 result = new(zone()) HDiv(context, double_one, square_root);
7899 } else if (exponent == 2.0) { 7904 } else if (exponent == 2.0) {
(...skipping 2767 matching lines...) Expand 10 before | Expand all | Expand 10 after
10667 } 10672 }
10668 } 10673 }
10669 10674
10670 #ifdef DEBUG 10675 #ifdef DEBUG
10671 if (graph_ != NULL) graph_->Verify(false); // No full verify. 10676 if (graph_ != NULL) graph_->Verify(false); // No full verify.
10672 if (allocator_ != NULL) allocator_->Verify(); 10677 if (allocator_ != NULL) allocator_->Verify();
10673 #endif 10678 #endif
10674 } 10679 }
10675 10680
10676 } } // namespace v8::internal 10681 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698