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

Side by Side Diff: src/hydrogen.cc

Issue 11348349: Improve array to string conversion. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years 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 9107 matching lines...) Expand 10 before | Expand all | Expand 10 after
9118 ASSERT(call->arguments()->length() == 2); 9118 ASSERT(call->arguments()->length() == 2);
9119 ASSERT_NE(NULL, call->arguments()->at(1)->AsLiteral()); 9119 ASSERT_NE(NULL, call->arguments()->at(1)->AsLiteral());
9120 Smi* index = Smi::cast(*(call->arguments()->at(1)->AsLiteral()->handle())); 9120 Smi* index = Smi::cast(*(call->arguments()->at(1)->AsLiteral()->handle()));
9121 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); 9121 CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
9122 HValue* date = Pop(); 9122 HValue* date = Pop();
9123 HDateField* result = new(zone()) HDateField(date, index); 9123 HDateField* result = new(zone()) HDateField(date, index);
9124 return ast_context()->ReturnInstruction(result, call->id()); 9124 return ast_context()->ReturnInstruction(result, call->id());
9125 } 9125 }
9126 9126
9127 9127
9128 void HGraphBuilder::GenerateOneByteSeqStringSetChar(CallRuntime* call) {
9129 ASSERT(call->arguments()->length() == 3);
9130 CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
9131 CHECK_ALIVE(VisitForValue(call->arguments()->at(1)));
9132 CHECK_ALIVE(VisitForValue(call->arguments()->at(2)));
9133 HValue* value = Pop();
9134 HValue* index = Pop();
9135 HValue* string = Pop();
9136 HSeqStringSetChar* result =
9137 new(zone()) HSeqStringSetChar(true, string, index, value);
9138 return ast_context()->ReturnInstruction(result, call->id());
9139 }
9140
9141
9142 void HGraphBuilder::GenerateTwoByteSeqStringSetChar(CallRuntime* call) {
9143 ASSERT(call->arguments()->length() == 3);
9144 CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
9145 CHECK_ALIVE(VisitForValue(call->arguments()->at(1)));
9146 CHECK_ALIVE(VisitForValue(call->arguments()->at(2)));
9147 HValue* value = Pop();
9148 HValue* index = Pop();
9149 HValue* string = Pop();
9150 HValue* context = environment()->LookupContext();
9151 HStringCharCodeAt* char_code = BuildStringCharCodeAt(context, string, index);
9152 AddInstruction(char_code);
9153 HSeqStringSetChar* result =
9154 new(zone()) HSeqStringSetChar(false, string, index, value);
9155 return ast_context()->ReturnInstruction(result, call->id());
9156 }
9157
9158
9128 void HGraphBuilder::GenerateSetValueOf(CallRuntime* call) { 9159 void HGraphBuilder::GenerateSetValueOf(CallRuntime* call) {
9129 ASSERT(call->arguments()->length() == 2); 9160 ASSERT(call->arguments()->length() == 2);
9130 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); 9161 CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
9131 CHECK_ALIVE(VisitForValue(call->arguments()->at(1))); 9162 CHECK_ALIVE(VisitForValue(call->arguments()->at(1)));
9132 HValue* value = Pop(); 9163 HValue* value = Pop();
9133 HValue* object = Pop(); 9164 HValue* object = Pop();
9134 // Check if object is a not a smi. 9165 // Check if object is a not a smi.
9135 HIsSmiAndBranch* smicheck = new(zone()) HIsSmiAndBranch(object); 9166 HIsSmiAndBranch* smicheck = new(zone()) HIsSmiAndBranch(object);
9136 HBasicBlock* if_smi = graph()->CreateBasicBlock(); 9167 HBasicBlock* if_smi = graph()->CreateBasicBlock();
9137 HBasicBlock* if_heap_object = graph()->CreateBasicBlock(); 9168 HBasicBlock* if_heap_object = graph()->CreateBasicBlock();
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
10059 } 10090 }
10060 } 10091 }
10061 10092
10062 #ifdef DEBUG 10093 #ifdef DEBUG
10063 if (graph_ != NULL) graph_->Verify(false); // No full verify. 10094 if (graph_ != NULL) graph_->Verify(false); // No full verify.
10064 if (allocator_ != NULL) allocator_->Verify(); 10095 if (allocator_ != NULL) allocator_->Verify();
10065 #endif 10096 #endif
10066 } 10097 }
10067 10098
10068 } } // namespace v8::internal 10099 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698