| 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 } | 187 } |
| 188 | 188 |
| 189 | 189 |
| 190 void LGoto::PrintDataTo(StringStream* stream) { | 190 void LGoto::PrintDataTo(StringStream* stream) { |
| 191 stream->Add("B%d", block_id()); | 191 stream->Add("B%d", block_id()); |
| 192 } | 192 } |
| 193 | 193 |
| 194 | 194 |
| 195 void LBranch::PrintDataTo(StringStream* stream) { | 195 void LBranch::PrintDataTo(StringStream* stream) { |
| 196 stream->Add("B%d | B%d on ", true_block_id(), false_block_id()); | 196 stream->Add("B%d | B%d on ", true_block_id(), false_block_id()); |
| 197 value()->PrintTo(stream); | 197 InputAt(0)->PrintTo(stream); |
| 198 } | 198 } |
| 199 | 199 |
| 200 | 200 |
| 201 void LCmpIDAndBranch::PrintDataTo(StringStream* stream) { | 201 void LCmpIDAndBranch::PrintDataTo(StringStream* stream) { |
| 202 stream->Add("if "); | 202 stream->Add("if "); |
| 203 left()->PrintTo(stream); | 203 InputAt(0)->PrintTo(stream); |
| 204 stream->Add(" %s ", Token::String(op())); | 204 stream->Add(" %s ", Token::String(op())); |
| 205 right()->PrintTo(stream); | 205 InputAt(1)->PrintTo(stream); |
| 206 stream->Add(" then B%d else B%d", true_block_id(), false_block_id()); | 206 stream->Add(" then B%d else B%d", true_block_id(), false_block_id()); |
| 207 } | 207 } |
| 208 | 208 |
| 209 | 209 |
| 210 void LIsNilAndBranch::PrintDataTo(StringStream* stream) { | 210 void LIsNilAndBranch::PrintDataTo(StringStream* stream) { |
| 211 stream->Add("if "); | 211 stream->Add("if "); |
| 212 value()->PrintTo(stream); | 212 InputAt(0)->PrintTo(stream); |
| 213 stream->Add(kind() == kStrictEquality ? " === " : " == "); | 213 stream->Add(kind() == kStrictEquality ? " === " : " == "); |
| 214 stream->Add(nil() == kNullValue ? "null" : "undefined"); | 214 stream->Add(nil() == kNullValue ? "null" : "undefined"); |
| 215 stream->Add(" then B%d else B%d", true_block_id(), false_block_id()); | 215 stream->Add(" then B%d else B%d", true_block_id(), false_block_id()); |
| 216 } | 216 } |
| 217 | 217 |
| 218 | 218 |
| 219 void LIsObjectAndBranch::PrintDataTo(StringStream* stream) { | 219 void LIsObjectAndBranch::PrintDataTo(StringStream* stream) { |
| 220 stream->Add("if is_object("); | 220 stream->Add("if is_object("); |
| 221 value()->PrintTo(stream); | 221 InputAt(0)->PrintTo(stream); |
| 222 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); | 222 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); |
| 223 } | 223 } |
| 224 | 224 |
| 225 | 225 |
| 226 void LIsStringAndBranch::PrintDataTo(StringStream* stream) { | 226 void LIsStringAndBranch::PrintDataTo(StringStream* stream) { |
| 227 stream->Add("if is_string("); | 227 stream->Add("if is_string("); |
| 228 value()->PrintTo(stream); | 228 InputAt(0)->PrintTo(stream); |
| 229 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); | 229 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); |
| 230 } | 230 } |
| 231 | 231 |
| 232 | 232 |
| 233 void LIsSmiAndBranch::PrintDataTo(StringStream* stream) { | 233 void LIsSmiAndBranch::PrintDataTo(StringStream* stream) { |
| 234 stream->Add("if is_smi("); | 234 stream->Add("if is_smi("); |
| 235 value()->PrintTo(stream); | 235 InputAt(0)->PrintTo(stream); |
| 236 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); | 236 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); |
| 237 } | 237 } |
| 238 | 238 |
| 239 | 239 |
| 240 void LIsUndetectableAndBranch::PrintDataTo(StringStream* stream) { | 240 void LIsUndetectableAndBranch::PrintDataTo(StringStream* stream) { |
| 241 stream->Add("if is_undetectable("); | 241 stream->Add("if is_undetectable("); |
| 242 value()->PrintTo(stream); | 242 InputAt(0)->PrintTo(stream); |
| 243 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); | 243 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); |
| 244 } | 244 } |
| 245 | 245 |
| 246 | 246 |
| 247 void LStringCompareAndBranch::PrintDataTo(StringStream* stream) { | 247 void LStringCompareAndBranch::PrintDataTo(StringStream* stream) { |
| 248 stream->Add("if string_compare("); | 248 stream->Add("if string_compare("); |
| 249 left()->PrintTo(stream); | 249 InputAt(0)->PrintTo(stream); |
| 250 right()->PrintTo(stream); | 250 InputAt(1)->PrintTo(stream); |
| 251 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); | 251 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); |
| 252 } | 252 } |
| 253 | 253 |
| 254 | 254 |
| 255 void LHasInstanceTypeAndBranch::PrintDataTo(StringStream* stream) { | 255 void LHasInstanceTypeAndBranch::PrintDataTo(StringStream* stream) { |
| 256 stream->Add("if has_instance_type("); | 256 stream->Add("if has_instance_type("); |
| 257 value()->PrintTo(stream); | 257 InputAt(0)->PrintTo(stream); |
| 258 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); | 258 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); |
| 259 } | 259 } |
| 260 | 260 |
| 261 | 261 |
| 262 void LHasCachedArrayIndexAndBranch::PrintDataTo(StringStream* stream) { | 262 void LHasCachedArrayIndexAndBranch::PrintDataTo(StringStream* stream) { |
| 263 stream->Add("if has_cached_array_index("); | 263 stream->Add("if has_cached_array_index("); |
| 264 value()->PrintTo(stream); | 264 InputAt(0)->PrintTo(stream); |
| 265 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); | 265 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); |
| 266 } | 266 } |
| 267 | 267 |
| 268 | 268 |
| 269 void LClassOfTestAndBranch::PrintDataTo(StringStream* stream) { | 269 void LClassOfTestAndBranch::PrintDataTo(StringStream* stream) { |
| 270 stream->Add("if class_of_test("); | 270 stream->Add("if class_of_test("); |
| 271 value()->PrintTo(stream); | 271 InputAt(0)->PrintTo(stream); |
| 272 stream->Add(", \"%o\") then B%d else B%d", | 272 stream->Add(", \"%o\") then B%d else B%d", |
| 273 *hydrogen()->class_name(), | 273 *hydrogen()->class_name(), |
| 274 true_block_id(), | 274 true_block_id(), |
| 275 false_block_id()); | 275 false_block_id()); |
| 276 } | 276 } |
| 277 | 277 |
| 278 | 278 |
| 279 void LTypeofIsAndBranch::PrintDataTo(StringStream* stream) { | 279 void LTypeofIsAndBranch::PrintDataTo(StringStream* stream) { |
| 280 stream->Add("if typeof "); | 280 stream->Add("if typeof "); |
| 281 value()->PrintTo(stream); | 281 InputAt(0)->PrintTo(stream); |
| 282 stream->Add(" == \"%s\" then B%d else B%d", | 282 stream->Add(" == \"%s\" then B%d else B%d", |
| 283 *hydrogen()->type_literal()->ToCString(), | 283 *hydrogen()->type_literal()->ToCString(), |
| 284 true_block_id(), false_block_id()); | 284 true_block_id(), false_block_id()); |
| 285 } | 285 } |
| 286 | 286 |
| 287 | 287 |
| 288 void LCallConstantFunction::PrintDataTo(StringStream* stream) { | 288 void LCallConstantFunction::PrintDataTo(StringStream* stream) { |
| 289 stream->Add("#%d / ", arity()); | 289 stream->Add("#%d / ", arity()); |
| 290 } | 290 } |
| 291 | 291 |
| 292 | 292 |
| 293 void LUnaryMathOperation::PrintDataTo(StringStream* stream) { | 293 void LUnaryMathOperation::PrintDataTo(StringStream* stream) { |
| 294 stream->Add("/%s ", hydrogen()->OpName()); | 294 stream->Add("/%s ", hydrogen()->OpName()); |
| 295 value()->PrintTo(stream); | 295 InputAt(0)->PrintTo(stream); |
| 296 } | 296 } |
| 297 | 297 |
| 298 | 298 |
| 299 void LLoadContextSlot::PrintDataTo(StringStream* stream) { | 299 void LLoadContextSlot::PrintDataTo(StringStream* stream) { |
| 300 context()->PrintTo(stream); | 300 InputAt(0)->PrintTo(stream); |
| 301 stream->Add("[%d]", slot_index()); | 301 stream->Add("[%d]", slot_index()); |
| 302 } | 302 } |
| 303 | 303 |
| 304 | 304 |
| 305 void LStoreContextSlot::PrintDataTo(StringStream* stream) { | 305 void LStoreContextSlot::PrintDataTo(StringStream* stream) { |
| 306 context()->PrintTo(stream); | 306 InputAt(0)->PrintTo(stream); |
| 307 stream->Add("[%d] <- ", slot_index()); | 307 stream->Add("[%d] <- ", slot_index()); |
| 308 value()->PrintTo(stream); | 308 InputAt(1)->PrintTo(stream); |
| 309 } | 309 } |
| 310 | 310 |
| 311 | 311 |
| 312 void LInvokeFunction::PrintDataTo(StringStream* stream) { | 312 void LInvokeFunction::PrintDataTo(StringStream* stream) { |
| 313 stream->Add("= "); | 313 stream->Add("= "); |
| 314 function()->PrintTo(stream); | 314 InputAt(0)->PrintTo(stream); |
| 315 stream->Add(" #%d / ", arity()); | 315 stream->Add(" #%d / ", arity()); |
| 316 } | 316 } |
| 317 | 317 |
| 318 | 318 |
| 319 void LCallKeyed::PrintDataTo(StringStream* stream) { | 319 void LCallKeyed::PrintDataTo(StringStream* stream) { |
| 320 stream->Add("[r2] #%d / ", arity()); | 320 stream->Add("[r2] #%d / ", arity()); |
| 321 } | 321 } |
| 322 | 322 |
| 323 | 323 |
| 324 void LCallNamed::PrintDataTo(StringStream* stream) { | 324 void LCallNamed::PrintDataTo(StringStream* stream) { |
| 325 SmartArrayPointer<char> name_string = name()->ToCString(); | 325 SmartArrayPointer<char> name_string = name()->ToCString(); |
| 326 stream->Add("%s #%d / ", *name_string, arity()); | 326 stream->Add("%s #%d / ", *name_string, arity()); |
| 327 } | 327 } |
| 328 | 328 |
| 329 | 329 |
| 330 void LCallGlobal::PrintDataTo(StringStream* stream) { | 330 void LCallGlobal::PrintDataTo(StringStream* stream) { |
| 331 SmartArrayPointer<char> name_string = name()->ToCString(); | 331 SmartArrayPointer<char> name_string = name()->ToCString(); |
| 332 stream->Add("%s #%d / ", *name_string, arity()); | 332 stream->Add("%s #%d / ", *name_string, arity()); |
| 333 } | 333 } |
| 334 | 334 |
| 335 | 335 |
| 336 void LCallKnownGlobal::PrintDataTo(StringStream* stream) { | 336 void LCallKnownGlobal::PrintDataTo(StringStream* stream) { |
| 337 stream->Add("#%d / ", arity()); | 337 stream->Add("#%d / ", arity()); |
| 338 } | 338 } |
| 339 | 339 |
| 340 | 340 |
| 341 void LCallNew::PrintDataTo(StringStream* stream) { | 341 void LCallNew::PrintDataTo(StringStream* stream) { |
| 342 stream->Add("= "); | 342 stream->Add("= "); |
| 343 constructor()->PrintTo(stream); | 343 InputAt(0)->PrintTo(stream); |
| 344 stream->Add(" #%d / ", arity()); | 344 stream->Add(" #%d / ", arity()); |
| 345 } | 345 } |
| 346 | 346 |
| 347 | 347 |
| 348 void LAccessArgumentsAt::PrintDataTo(StringStream* stream) { | 348 void LAccessArgumentsAt::PrintDataTo(StringStream* stream) { |
| 349 arguments()->PrintTo(stream); | 349 arguments()->PrintTo(stream); |
| 350 |
| 350 stream->Add(" length "); | 351 stream->Add(" length "); |
| 351 length()->PrintTo(stream); | 352 length()->PrintTo(stream); |
| 353 |
| 352 stream->Add(" index "); | 354 stream->Add(" index "); |
| 353 index()->PrintTo(stream); | 355 index()->PrintTo(stream); |
| 354 } | 356 } |
| 355 | 357 |
| 356 | 358 |
| 357 void LStoreNamedField::PrintDataTo(StringStream* stream) { | 359 void LStoreNamedField::PrintDataTo(StringStream* stream) { |
| 358 object()->PrintTo(stream); | 360 object()->PrintTo(stream); |
| 359 stream->Add("."); | 361 stream->Add("."); |
| 360 stream->Add(*String::cast(*name())->ToCString()); | 362 stream->Add(*String::cast(*name())->ToCString()); |
| 361 stream->Add(" <- "); | 363 stream->Add(" <- "); |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 851 hydrogen_env->frame_type() != JS_FUNCTION); | 853 hydrogen_env->frame_type() != JS_FUNCTION); |
| 852 int value_count = hydrogen_env->length(); | 854 int value_count = hydrogen_env->length(); |
| 853 LEnvironment* result = new(zone()) LEnvironment( | 855 LEnvironment* result = new(zone()) LEnvironment( |
| 854 hydrogen_env->closure(), | 856 hydrogen_env->closure(), |
| 855 hydrogen_env->frame_type(), | 857 hydrogen_env->frame_type(), |
| 856 ast_id, | 858 ast_id, |
| 857 hydrogen_env->parameter_count(), | 859 hydrogen_env->parameter_count(), |
| 858 argument_count_, | 860 argument_count_, |
| 859 value_count, | 861 value_count, |
| 860 outer, | 862 outer, |
| 861 hydrogen_env->entry(), | |
| 862 zone()); | 863 zone()); |
| 863 int argument_index = *argument_index_accumulator; | 864 int argument_index = *argument_index_accumulator; |
| 864 for (int i = 0; i < value_count; ++i) { | 865 for (int i = 0; i < value_count; ++i) { |
| 865 if (hydrogen_env->is_special_index(i)) continue; | 866 if (hydrogen_env->is_special_index(i)) continue; |
| 866 | 867 |
| 867 HValue* value = hydrogen_env->values()->at(i); | 868 HValue* value = hydrogen_env->values()->at(i); |
| 868 LOperand* op = NULL; | 869 LOperand* op = NULL; |
| 869 if (value->IsArgumentsObject()) { | 870 if (value->IsArgumentsObject()) { |
| 870 op = NULL; | 871 op = NULL; |
| 871 } else if (value->IsPushArgument()) { | 872 } else if (value->IsPushArgument()) { |
| (...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2118 | 2119 |
| 2119 LInstruction* LChunkBuilder::DoDeleteProperty(HDeleteProperty* instr) { | 2120 LInstruction* LChunkBuilder::DoDeleteProperty(HDeleteProperty* instr) { |
| 2120 LOperand* object = UseFixed(instr->object(), r0); | 2121 LOperand* object = UseFixed(instr->object(), r0); |
| 2121 LOperand* key = UseFixed(instr->key(), r1); | 2122 LOperand* key = UseFixed(instr->key(), r1); |
| 2122 LDeleteProperty* result = new(zone()) LDeleteProperty(object, key); | 2123 LDeleteProperty* result = new(zone()) LDeleteProperty(object, key); |
| 2123 return MarkAsCall(DefineFixed(result, r0), instr); | 2124 return MarkAsCall(DefineFixed(result, r0), instr); |
| 2124 } | 2125 } |
| 2125 | 2126 |
| 2126 | 2127 |
| 2127 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { | 2128 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { |
| 2128 ASSERT(argument_count_ == 0); | |
| 2129 allocator_->MarkAsOsrEntry(); | 2129 allocator_->MarkAsOsrEntry(); |
| 2130 current_block_->last_environment()->set_ast_id(instr->ast_id()); | 2130 current_block_->last_environment()->set_ast_id(instr->ast_id()); |
| 2131 return AssignEnvironment(new(zone()) LOsrEntry); | 2131 return AssignEnvironment(new(zone()) LOsrEntry); |
| 2132 } | 2132 } |
| 2133 | 2133 |
| 2134 | 2134 |
| 2135 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) { | 2135 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) { |
| 2136 int spill_index = chunk()->GetParameterStackSlot(instr->index()); | 2136 int spill_index = chunk()->GetParameterStackSlot(instr->index()); |
| 2137 return DefineAsSpilled(new(zone()) LParameter, spill_index); | 2137 return DefineAsSpilled(new(zone()) LParameter, spill_index); |
| 2138 } | 2138 } |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2246 HConstant* undefined = graph()->GetConstantUndefined(); | 2246 HConstant* undefined = graph()->GetConstantUndefined(); |
| 2247 HEnvironment* inner = outer->CopyForInlining(instr->closure(), | 2247 HEnvironment* inner = outer->CopyForInlining(instr->closure(), |
| 2248 instr->arguments_count(), | 2248 instr->arguments_count(), |
| 2249 instr->function(), | 2249 instr->function(), |
| 2250 undefined, | 2250 undefined, |
| 2251 instr->call_kind(), | 2251 instr->call_kind(), |
| 2252 instr->inlining_kind()); | 2252 instr->inlining_kind()); |
| 2253 if (instr->arguments_var() != NULL) { | 2253 if (instr->arguments_var() != NULL) { |
| 2254 inner->Bind(instr->arguments_var(), graph()->GetArgumentsObject()); | 2254 inner->Bind(instr->arguments_var(), graph()->GetArgumentsObject()); |
| 2255 } | 2255 } |
| 2256 inner->set_entry(instr); | |
| 2257 current_block_->UpdateEnvironment(inner); | 2256 current_block_->UpdateEnvironment(inner); |
| 2258 chunk_->AddInlinedClosure(instr->closure()); | 2257 chunk_->AddInlinedClosure(instr->closure()); |
| 2259 return NULL; | 2258 return NULL; |
| 2260 } | 2259 } |
| 2261 | 2260 |
| 2262 | 2261 |
| 2263 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 2262 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
| 2264 LInstruction* pop = NULL; | 2263 LInstruction* pop = NULL; |
| 2265 | 2264 |
| 2266 HEnvironment* env = current_block_->last_environment(); | 2265 HEnvironment* env = current_block_->last_environment(); |
| 2267 | 2266 |
| 2268 if (env->entry()->arguments_pushed()) { | 2267 if (instr->arguments_pushed()) { |
| 2269 int argument_count = env->arguments_environment()->parameter_count(); | 2268 int argument_count = env->arguments_environment()->parameter_count(); |
| 2270 pop = new(zone()) LDrop(argument_count); | 2269 pop = new(zone()) LDrop(argument_count); |
| 2271 argument_count_ -= argument_count; | 2270 argument_count_ -= argument_count; |
| 2272 } | 2271 } |
| 2273 | 2272 |
| 2274 HEnvironment* outer = current_block_->last_environment()-> | 2273 HEnvironment* outer = current_block_->last_environment()-> |
| 2275 DiscardInlined(false); | 2274 DiscardInlined(false); |
| 2276 current_block_->UpdateEnvironment(outer); | 2275 current_block_->UpdateEnvironment(outer); |
| 2277 | 2276 |
| 2278 return pop; | 2277 return pop; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2310 | 2309 |
| 2311 | 2310 |
| 2312 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2311 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2313 LOperand* object = UseRegister(instr->object()); | 2312 LOperand* object = UseRegister(instr->object()); |
| 2314 LOperand* index = UseRegister(instr->index()); | 2313 LOperand* index = UseRegister(instr->index()); |
| 2315 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2314 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
| 2316 } | 2315 } |
| 2317 | 2316 |
| 2318 | 2317 |
| 2319 } } // namespace v8::internal | 2318 } } // namespace v8::internal |
| OLD | NEW |