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