OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 2063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2074 | 2074 |
2075 void LCodeGen::DoSmiTag(LSmiTag* instr) { | 2075 void LCodeGen::DoSmiTag(LSmiTag* instr) { |
2076 LOperand* input = instr->input(); | 2076 LOperand* input = instr->input(); |
2077 ASSERT(input->IsRegister() && input->Equals(instr->result())); | 2077 ASSERT(input->IsRegister() && input->Equals(instr->result())); |
2078 ASSERT(!instr->hydrogen_value()->CheckFlag(HValue::kCanOverflow)); | 2078 ASSERT(!instr->hydrogen_value()->CheckFlag(HValue::kCanOverflow)); |
2079 __ SmiTag(ToRegister(input)); | 2079 __ SmiTag(ToRegister(input)); |
2080 } | 2080 } |
2081 | 2081 |
2082 | 2082 |
2083 void LCodeGen::DoSmiUntag(LSmiUntag* instr) { | 2083 void LCodeGen::DoSmiUntag(LSmiUntag* instr) { |
2084 Abort("DoSmiUntag unimplemented."); | 2084 LOperand* input = instr->input(); |
| 2085 ASSERT(input->IsRegister() && input->Equals(instr->result())); |
| 2086 if (instr->needs_check()) { |
| 2087 __ tst(ToRegister(input), Operand(kSmiTagMask)); |
| 2088 DeoptimizeIf(ne, instr->environment()); |
| 2089 } |
| 2090 __ SmiUntag(ToRegister(input)); |
2085 } | 2091 } |
2086 | 2092 |
2087 | 2093 |
2088 void LCodeGen::EmitNumberUntagD(Register input_reg, | 2094 void LCodeGen::EmitNumberUntagD(Register input_reg, |
2089 DoubleRegister result_reg, | 2095 DoubleRegister result_reg, |
2090 LEnvironment* env) { | 2096 LEnvironment* env) { |
2091 Register scratch = scratch0(); | 2097 Register scratch = scratch0(); |
2092 SwVfpRegister flt_scratch = s0; | 2098 SwVfpRegister flt_scratch = s0; |
2093 ASSERT(!result_reg.is(d0)); | 2099 ASSERT(!result_reg.is(d0)); |
2094 | 2100 |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2448 __ mov(r1, Operand(pretenure | 2454 __ mov(r1, Operand(pretenure |
2449 ? Factory::true_value() | 2455 ? Factory::true_value() |
2450 : Factory::false_value())); | 2456 : Factory::false_value())); |
2451 __ Push(cp, r2, r1); | 2457 __ Push(cp, r2, r1); |
2452 CallRuntime(Runtime::kNewClosure, 3, instr); | 2458 CallRuntime(Runtime::kNewClosure, 3, instr); |
2453 } | 2459 } |
2454 } | 2460 } |
2455 | 2461 |
2456 | 2462 |
2457 void LCodeGen::DoTypeof(LTypeof* instr) { | 2463 void LCodeGen::DoTypeof(LTypeof* instr) { |
2458 Abort("DoTypeof unimplemented."); | 2464 Register input = ToRegister(instr->input()); |
| 2465 __ push(input); |
| 2466 CallRuntime(Runtime::kTypeof, 1, instr); |
2459 } | 2467 } |
2460 | 2468 |
2461 | 2469 |
2462 void LCodeGen::DoTypeofIs(LTypeofIs* instr) { | 2470 void LCodeGen::DoTypeofIs(LTypeofIs* instr) { |
2463 Abort("DoTypeofIs unimplemented."); | 2471 Register input = ToRegister(instr->input()); |
| 2472 Register result = ToRegister(instr->result()); |
| 2473 Label true_label; |
| 2474 Label false_label; |
| 2475 Label done; |
| 2476 |
| 2477 Condition final_branch_condition = EmitTypeofIs(&true_label, |
| 2478 &false_label, |
| 2479 input, |
| 2480 instr->type_literal()); |
| 2481 |
| 2482 __ LoadRoot(result, Heap::kTrueValueRootIndex, final_branch_condition); |
| 2483 __ LoadRoot(result, Heap::kFalseValueRootIndex, |
| 2484 NegateCondition(final_branch_condition)); |
2464 } | 2485 } |
2465 | 2486 |
2466 | 2487 |
2467 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) { | 2488 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) { |
2468 Register input = ToRegister(instr->input()); | 2489 Register input = ToRegister(instr->input()); |
2469 int true_block = chunk_->LookupDestination(instr->true_block_id()); | 2490 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
2470 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 2491 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
2471 Label* true_label = chunk_->GetAssemblyLabel(true_block); | 2492 Label* true_label = chunk_->GetAssemblyLabel(true_block); |
2472 Label* false_label = chunk_->GetAssemblyLabel(false_block); | 2493 Label* false_label = chunk_->GetAssemblyLabel(false_block); |
2473 | 2494 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2591 | 2612 |
2592 | 2613 |
2593 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { | 2614 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { |
2594 Abort("DoOsrEntry unimplemented."); | 2615 Abort("DoOsrEntry unimplemented."); |
2595 } | 2616 } |
2596 | 2617 |
2597 | 2618 |
2598 #undef __ | 2619 #undef __ |
2599 | 2620 |
2600 } } // namespace v8::internal | 2621 } } // namespace v8::internal |
OLD | NEW |