OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 2165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2176 for (int i = 0, entry_pos = table_start.pos(); | 2176 for (int i = 0, entry_pos = table_start.pos(); |
2177 i < range; | 2177 i < range; |
2178 i++, entry_pos += sizeof(uint32_t)) { | 2178 i++, entry_pos += sizeof(uint32_t)) { |
2179 if (case_targets[i] == NULL) { | 2179 if (case_targets[i] == NULL) { |
2180 __ WriteInternalReference(entry_pos, | 2180 __ WriteInternalReference(entry_pos, |
2181 *node->break_target()->entry_label()); | 2181 *node->break_target()->entry_label()); |
2182 } else { | 2182 } else { |
2183 __ WriteInternalReference(entry_pos, *case_targets[i]); | 2183 __ WriteInternalReference(entry_pos, *case_targets[i]); |
2184 } | 2184 } |
2185 } | 2185 } |
2186 | |
2187 delete start_frame; | |
2188 } | 2186 } |
2189 | 2187 |
2190 | 2188 |
2191 void CodeGenerator::VisitSwitchStatement(SwitchStatement* node) { | 2189 void CodeGenerator::VisitSwitchStatement(SwitchStatement* node) { |
2192 ASSERT(!in_spilled_code()); | 2190 ASSERT(!in_spilled_code()); |
2193 Comment cmnt(masm_, "[ SwitchStatement"); | 2191 Comment cmnt(masm_, "[ SwitchStatement"); |
2194 CodeForStatementPosition(node); | 2192 CodeForStatementPosition(node); |
2195 node->break_target()->Initialize(this); | 2193 node->break_target()->Initialize(this); |
2196 | 2194 |
2197 // Compile the switch value. | 2195 // Compile the switch value. |
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2971 frame_->Drop(StackHandlerConstants::kSize / kPointerSize - 1); | 2969 frame_->Drop(StackHandlerConstants::kSize / kPointerSize - 1); |
2972 // next_sp popped. | 2970 // next_sp popped. |
2973 | 2971 |
2974 if (i == kReturnShadowIndex) { | 2972 if (i == kReturnShadowIndex) { |
2975 if (!function_return_is_shadowed_) frame_->PrepareForReturn(); | 2973 if (!function_return_is_shadowed_) frame_->PrepareForReturn(); |
2976 shadows[i]->other_target()->Jump(&return_value); | 2974 shadows[i]->other_target()->Jump(&return_value); |
2977 } else { | 2975 } else { |
2978 shadows[i]->other_target()->Jump(); | 2976 shadows[i]->other_target()->Jump(); |
2979 } | 2977 } |
2980 } | 2978 } |
2981 delete shadows[i]; | |
2982 } | 2979 } |
2983 | 2980 |
2984 exit.Bind(); | 2981 exit.Bind(); |
2985 } | 2982 } |
2986 | 2983 |
2987 | 2984 |
2988 void CodeGenerator::VisitTryFinally(TryFinally* node) { | 2985 void CodeGenerator::VisitTryFinally(TryFinally* node) { |
2989 ASSERT(!in_spilled_code()); | 2986 ASSERT(!in_spilled_code()); |
2990 VirtualFrame::SpilledScope spilled_scope(this); | 2987 VirtualFrame::SpilledScope spilled_scope(this); |
2991 Comment cmnt(masm_, "[ TryFinally"); | 2988 Comment cmnt(masm_, "[ TryFinally"); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3152 JumpTarget skip(this); | 3149 JumpTarget skip(this); |
3153 skip.Branch(not_equal); | 3150 skip.Branch(not_equal); |
3154 frame_->PrepareForReturn(); | 3151 frame_->PrepareForReturn(); |
3155 original->Jump(&return_value); | 3152 original->Jump(&return_value); |
3156 skip.Bind(); | 3153 skip.Bind(); |
3157 } | 3154 } |
3158 } else { | 3155 } else { |
3159 original->Branch(equal); | 3156 original->Branch(equal); |
3160 } | 3157 } |
3161 } | 3158 } |
3162 delete shadows[i]; | |
3163 } | 3159 } |
3164 | 3160 |
3165 if (has_valid_frame()) { | 3161 if (has_valid_frame()) { |
3166 // Check if we need to rethrow the exception. | 3162 // Check if we need to rethrow the exception. |
3167 JumpTarget exit(this); | 3163 JumpTarget exit(this); |
3168 __ cmp(Operand(ecx), Immediate(Smi::FromInt(THROWING))); | 3164 __ cmp(Operand(ecx), Immediate(Smi::FromInt(THROWING))); |
3169 exit.Branch(not_equal); | 3165 exit.Branch(not_equal); |
3170 | 3166 |
3171 // Rethrow exception. | 3167 // Rethrow exception. |
3172 frame_->EmitPush(eax); // undo pop from above | 3168 frame_->EmitPush(eax); // undo pop from above |
(...skipping 4069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7242 | 7238 |
7243 // Slow-case: Go through the JavaScript implementation. | 7239 // Slow-case: Go through the JavaScript implementation. |
7244 __ bind(&slow); | 7240 __ bind(&slow); |
7245 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); | 7241 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); |
7246 } | 7242 } |
7247 | 7243 |
7248 | 7244 |
7249 #undef __ | 7245 #undef __ |
7250 | 7246 |
7251 } } // namespace v8::internal | 7247 } } // namespace v8::internal |
OLD | NEW |