| 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 *hydrogen()->class_name(), | 252 *hydrogen()->class_name(), |
| 253 true_block_id(), | 253 true_block_id(), |
| 254 false_block_id()); | 254 false_block_id()); |
| 255 } | 255 } |
| 256 | 256 |
| 257 | 257 |
| 258 void LTypeofIsAndBranch::PrintDataTo(StringStream* stream) { | 258 void LTypeofIsAndBranch::PrintDataTo(StringStream* stream) { |
| 259 stream->Add("if typeof "); | 259 stream->Add("if typeof "); |
| 260 value()->PrintTo(stream); | 260 value()->PrintTo(stream); |
| 261 stream->Add(" == \"%s\" then B%d else B%d", | 261 stream->Add(" == \"%s\" then B%d else B%d", |
| 262 *hydrogen()->type_literal()->ToCString(), | 262 hydrogen()->type_literal()->ToCString().get(), |
| 263 true_block_id(), false_block_id()); | 263 true_block_id(), false_block_id()); |
| 264 } | 264 } |
| 265 | 265 |
| 266 | 266 |
| 267 void LStoreCodeEntry::PrintDataTo(StringStream* stream) { | 267 void LStoreCodeEntry::PrintDataTo(StringStream* stream) { |
| 268 stream->Add(" = "); | 268 stream->Add(" = "); |
| 269 function()->PrintTo(stream); | 269 function()->PrintTo(stream); |
| 270 stream->Add(".code_entry = "); | 270 stream->Add(".code_entry = "); |
| 271 code_object()->PrintTo(stream); | 271 code_object()->PrintTo(stream); |
| 272 } | 272 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 } | 305 } |
| 306 | 306 |
| 307 | 307 |
| 308 void LCallKeyed::PrintDataTo(StringStream* stream) { | 308 void LCallKeyed::PrintDataTo(StringStream* stream) { |
| 309 stream->Add("[rcx] #%d / ", arity()); | 309 stream->Add("[rcx] #%d / ", arity()); |
| 310 } | 310 } |
| 311 | 311 |
| 312 | 312 |
| 313 void LCallNamed::PrintDataTo(StringStream* stream) { | 313 void LCallNamed::PrintDataTo(StringStream* stream) { |
| 314 SmartArrayPointer<char> name_string = name()->ToCString(); | 314 SmartArrayPointer<char> name_string = name()->ToCString(); |
| 315 stream->Add("%s #%d / ", *name_string, arity()); | 315 stream->Add("%s #%d / ", name_string.get(), arity()); |
| 316 } | 316 } |
| 317 | 317 |
| 318 | 318 |
| 319 void LCallGlobal::PrintDataTo(StringStream* stream) { | 319 void LCallGlobal::PrintDataTo(StringStream* stream) { |
| 320 SmartArrayPointer<char> name_string = name()->ToCString(); | 320 SmartArrayPointer<char> name_string = name()->ToCString(); |
| 321 stream->Add("%s #%d / ", *name_string, arity()); | 321 stream->Add("%s #%d / ", name_string.get(), arity()); |
| 322 } | 322 } |
| 323 | 323 |
| 324 | 324 |
| 325 void LCallKnownGlobal::PrintDataTo(StringStream* stream) { | 325 void LCallKnownGlobal::PrintDataTo(StringStream* stream) { |
| 326 stream->Add("#%d / ", arity()); | 326 stream->Add("#%d / ", arity()); |
| 327 } | 327 } |
| 328 | 328 |
| 329 | 329 |
| 330 void LCallNew::PrintDataTo(StringStream* stream) { | 330 void LCallNew::PrintDataTo(StringStream* stream) { |
| 331 stream->Add("= "); | 331 stream->Add("= "); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 object()->PrintTo(stream); | 377 object()->PrintTo(stream); |
| 378 hydrogen()->access().PrintTo(stream); | 378 hydrogen()->access().PrintTo(stream); |
| 379 stream->Add(" <- "); | 379 stream->Add(" <- "); |
| 380 value()->PrintTo(stream); | 380 value()->PrintTo(stream); |
| 381 } | 381 } |
| 382 | 382 |
| 383 | 383 |
| 384 void LStoreNamedGeneric::PrintDataTo(StringStream* stream) { | 384 void LStoreNamedGeneric::PrintDataTo(StringStream* stream) { |
| 385 object()->PrintTo(stream); | 385 object()->PrintTo(stream); |
| 386 stream->Add("."); | 386 stream->Add("."); |
| 387 stream->Add(*String::cast(*name())->ToCString()); | 387 stream->Add(String::cast(*name())->ToCString().get()); |
| 388 stream->Add(" <- "); | 388 stream->Add(" <- "); |
| 389 value()->PrintTo(stream); | 389 value()->PrintTo(stream); |
| 390 } | 390 } |
| 391 | 391 |
| 392 | 392 |
| 393 void LLoadKeyed::PrintDataTo(StringStream* stream) { | 393 void LLoadKeyed::PrintDataTo(StringStream* stream) { |
| 394 elements()->PrintTo(stream); | 394 elements()->PrintTo(stream); |
| 395 stream->Add("["); | 395 stream->Add("["); |
| 396 key()->PrintTo(stream); | 396 key()->PrintTo(stream); |
| 397 if (hydrogen()->IsDehoisted()) { | 397 if (hydrogen()->IsDehoisted()) { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER, | 501 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER, |
| 502 LUnallocated::USED_AT_START)); | 502 LUnallocated::USED_AT_START)); |
| 503 } | 503 } |
| 504 | 504 |
| 505 | 505 |
| 506 LOperand* LChunkBuilder::UseTempRegister(HValue* value) { | 506 LOperand* LChunkBuilder::UseTempRegister(HValue* value) { |
| 507 return Use(value, new(zone()) LUnallocated(LUnallocated::WRITABLE_REGISTER)); | 507 return Use(value, new(zone()) LUnallocated(LUnallocated::WRITABLE_REGISTER)); |
| 508 } | 508 } |
| 509 | 509 |
| 510 | 510 |
| 511 LOperand* LChunkBuilder::UseTempRegisterOrConstant(HValue* value) { |
| 512 return value->IsConstant() |
| 513 ? chunk_->DefineConstantOperand(HConstant::cast(value)) |
| 514 : UseTempRegister(value); |
| 515 } |
| 516 |
| 517 |
| 511 LOperand* LChunkBuilder::Use(HValue* value) { | 518 LOperand* LChunkBuilder::Use(HValue* value) { |
| 512 return Use(value, new(zone()) LUnallocated(LUnallocated::NONE)); | 519 return Use(value, new(zone()) LUnallocated(LUnallocated::NONE)); |
| 513 } | 520 } |
| 514 | 521 |
| 515 | 522 |
| 516 LOperand* LChunkBuilder::UseAtStart(HValue* value) { | 523 LOperand* LChunkBuilder::UseAtStart(HValue* value) { |
| 517 return Use(value, new(zone()) LUnallocated(LUnallocated::NONE, | 524 return Use(value, new(zone()) LUnallocated(LUnallocated::NONE, |
| 518 LUnallocated::USED_AT_START)); | 525 LUnallocated::USED_AT_START)); |
| 519 } | 526 } |
| 520 | 527 |
| (...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1216 LOperand* input = UseRegisterAtStart(instr->value()); | 1223 LOperand* input = UseRegisterAtStart(instr->value()); |
| 1217 LMathAbs* result = new(zone()) LMathAbs(context, input); | 1224 LMathAbs* result = new(zone()) LMathAbs(context, input); |
| 1218 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); | 1225 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); |
| 1219 } | 1226 } |
| 1220 | 1227 |
| 1221 | 1228 |
| 1222 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) { | 1229 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) { |
| 1223 ASSERT(instr->representation().IsDouble()); | 1230 ASSERT(instr->representation().IsDouble()); |
| 1224 ASSERT(instr->value()->representation().IsDouble()); | 1231 ASSERT(instr->value()->representation().IsDouble()); |
| 1225 LOperand* input = UseRegisterAtStart(instr->value()); | 1232 LOperand* input = UseRegisterAtStart(instr->value()); |
| 1226 LMathLog* result = new(zone()) LMathLog(input); | 1233 return MarkAsCall(DefineSameAsFirst(new(zone()) LMathLog(input)), instr); |
| 1227 return DefineSameAsFirst(result); | |
| 1228 } | 1234 } |
| 1229 | 1235 |
| 1230 | 1236 |
| 1231 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) { | 1237 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) { |
| 1232 ASSERT(instr->representation().IsDouble()); | 1238 ASSERT(instr->representation().IsDouble()); |
| 1233 ASSERT(instr->value()->representation().IsDouble()); | 1239 ASSERT(instr->value()->representation().IsDouble()); |
| 1234 LOperand* value = UseTempRegister(instr->value()); | 1240 LOperand* value = UseTempRegister(instr->value()); |
| 1235 LOperand* temp1 = TempRegister(); | 1241 LOperand* temp1 = TempRegister(); |
| 1236 LOperand* temp2 = TempRegister(); | 1242 LOperand* temp2 = TempRegister(); |
| 1237 LMathExp* result = new(zone()) LMathExp(value, temp1, temp2); | 1243 LMathExp* result = new(zone()) LMathExp(value, temp1, temp2); |
| (...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2171 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 2177 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
| 2172 ElementsKind elements_kind = instr->elements_kind(); | 2178 ElementsKind elements_kind = instr->elements_kind(); |
| 2173 | 2179 |
| 2174 if (!instr->is_external()) { | 2180 if (!instr->is_external()) { |
| 2175 ASSERT(instr->elements()->representation().IsTagged()); | 2181 ASSERT(instr->elements()->representation().IsTagged()); |
| 2176 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 2182 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
| 2177 LOperand* object = NULL; | 2183 LOperand* object = NULL; |
| 2178 LOperand* key = NULL; | 2184 LOperand* key = NULL; |
| 2179 LOperand* val = NULL; | 2185 LOperand* val = NULL; |
| 2180 | 2186 |
| 2181 if (instr->value()->representation().IsDouble()) { | 2187 Representation value_representation = instr->value()->representation(); |
| 2188 if (value_representation.IsDouble()) { |
| 2182 object = UseRegisterAtStart(instr->elements()); | 2189 object = UseRegisterAtStart(instr->elements()); |
| 2183 val = UseTempRegister(instr->value()); | 2190 val = UseTempRegister(instr->value()); |
| 2184 key = UseRegisterOrConstantAtStart(instr->key()); | 2191 key = UseRegisterOrConstantAtStart(instr->key()); |
| 2185 } else { | 2192 } else { |
| 2186 ASSERT(instr->value()->representation().IsSmiOrTagged()); | 2193 ASSERT(value_representation.IsSmiOrTagged() || |
| 2187 object = UseTempRegister(instr->elements()); | 2194 value_representation.IsInteger32()); |
| 2188 if (needs_write_barrier) { | 2195 if (needs_write_barrier) { |
| 2196 object = UseTempRegister(instr->elements()); |
| 2189 val = UseTempRegister(instr->value()); | 2197 val = UseTempRegister(instr->value()); |
| 2190 key = UseTempRegister(instr->key()); | 2198 key = UseTempRegister(instr->key()); |
| 2191 } else { | 2199 } else { |
| 2200 object = UseRegisterAtStart(instr->elements()); |
| 2192 val = UseRegisterOrConstantAtStart(instr->value()); | 2201 val = UseRegisterOrConstantAtStart(instr->value()); |
| 2193 key = UseRegisterOrConstantAtStart(instr->key()); | 2202 key = UseRegisterOrConstantAtStart(instr->key()); |
| 2194 } | 2203 } |
| 2195 } | 2204 } |
| 2196 | 2205 |
| 2197 return new(zone()) LStoreKeyed(object, key, val); | 2206 return new(zone()) LStoreKeyed(object, key, val); |
| 2198 } | 2207 } |
| 2199 | 2208 |
| 2200 ASSERT( | 2209 ASSERT( |
| 2201 (instr->value()->representation().IsInteger32() && | 2210 (instr->value()->representation().IsInteger32() && |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2290 !(FLAG_track_double_fields && instr->field_representation().IsDouble()); | 2299 !(FLAG_track_double_fields && instr->field_representation().IsDouble()); |
| 2291 | 2300 |
| 2292 LOperand* val; | 2301 LOperand* val; |
| 2293 if (needs_write_barrier) { | 2302 if (needs_write_barrier) { |
| 2294 val = UseTempRegister(instr->value()); | 2303 val = UseTempRegister(instr->value()); |
| 2295 } else if (is_external_location) { | 2304 } else if (is_external_location) { |
| 2296 val = UseFixed(instr->value(), rax); | 2305 val = UseFixed(instr->value(), rax); |
| 2297 } else if (can_be_constant) { | 2306 } else if (can_be_constant) { |
| 2298 val = UseRegisterOrConstant(instr->value()); | 2307 val = UseRegisterOrConstant(instr->value()); |
| 2299 } else if (FLAG_track_fields && instr->field_representation().IsSmi()) { | 2308 } else if (FLAG_track_fields && instr->field_representation().IsSmi()) { |
| 2300 val = UseTempRegister(instr->value()); | 2309 val = UseRegister(instr->value()); |
| 2301 } else if (FLAG_track_double_fields && | 2310 } else if (FLAG_track_double_fields && |
| 2302 instr->field_representation().IsDouble()) { | 2311 instr->field_representation().IsDouble()) { |
| 2303 val = UseRegisterAtStart(instr->value()); | 2312 val = UseRegisterAtStart(instr->value()); |
| 2304 } else { | 2313 } else { |
| 2305 val = UseRegister(instr->value()); | 2314 val = UseRegister(instr->value()); |
| 2306 } | 2315 } |
| 2307 | 2316 |
| 2308 // We only need a scratch register if we have a write barrier or we | 2317 // We only need a scratch register if we have a write barrier or we |
| 2309 // have a store into the properties array (not in-object-property). | 2318 // have a store into the properties array (not in-object-property). |
| 2310 LOperand* temp = (!is_in_object || needs_write_barrier || | 2319 LOperand* temp = (!is_in_object || needs_write_barrier || |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2600 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2609 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2601 LOperand* object = UseRegister(instr->object()); | 2610 LOperand* object = UseRegister(instr->object()); |
| 2602 LOperand* index = UseTempRegister(instr->index()); | 2611 LOperand* index = UseTempRegister(instr->index()); |
| 2603 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2612 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
| 2604 } | 2613 } |
| 2605 | 2614 |
| 2606 | 2615 |
| 2607 } } // namespace v8::internal | 2616 } } // namespace v8::internal |
| 2608 | 2617 |
| 2609 #endif // V8_TARGET_ARCH_X64 | 2618 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |