OLD | NEW |
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 // first one wins). | 372 // first one wins). |
373 for (int i = length-1; i >= 0 ; i--) { | 373 for (int i = length-1; i >= 0 ; i--) { |
374 CaseClause* clause = cases->at(i); | 374 CaseClause* clause = cases->at(i); |
375 if (!clause->is_default()) { | 375 if (!clause->is_default()) { |
376 Object* label_value = *(clause->label()->AsLiteral()->handle()); | 376 Object* label_value = *(clause->label()->AsLiteral()->handle()); |
377 int case_value = Smi::cast(label_value)->value(); | 377 int case_value = Smi::cast(label_value)->value(); |
378 case_targets[case_value - min_index] = &(case_labels[i]); | 378 case_targets[case_value - min_index] = &(case_labels[i]); |
379 } | 379 } |
380 } | 380 } |
381 | 381 |
382 GenerateFastCaseSwitchJumpTable(node, min_index, range, fail_label, | 382 GenerateFastCaseSwitchJumpTable(node, |
383 case_targets, case_labels); | 383 min_index, |
| 384 range, |
| 385 fail_label, |
| 386 Vector<Label*>(*case_targets, range), |
| 387 Vector<Label>(*case_labels, length)); |
384 } | 388 } |
385 | 389 |
386 | 390 |
387 void CodeGenerator::GenerateFastCaseSwitchCases( | 391 void CodeGenerator::GenerateFastCaseSwitchCases( |
388 SwitchStatement* node, | 392 SwitchStatement* node, |
389 SmartPointer<Label>& case_labels) { | 393 Vector<Label> case_labels) { |
390 ZoneList<CaseClause*>* cases = node->cases(); | 394 ZoneList<CaseClause*>* cases = node->cases(); |
391 int length = cases->length(); | 395 int length = cases->length(); |
392 | 396 |
393 for (int i = 0; i < length; i++) { | 397 for (int i = 0; i < length; i++) { |
394 Comment cmnt(masm(), "[ Case clause"); | 398 Comment cmnt(masm(), "[ Case clause"); |
395 masm()->bind(&(case_labels[i])); | 399 masm()->bind(&(case_labels[i])); |
396 VisitStatements(cases->at(i)->statements()); | 400 VisitStatements(cases->at(i)->statements()); |
397 } | 401 } |
398 | 402 |
399 masm()->bind(node->break_target()); | 403 masm()->bind(node->break_target()); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 void ArgumentsAccessStub::Generate(MacroAssembler* masm) { | 465 void ArgumentsAccessStub::Generate(MacroAssembler* masm) { |
462 switch (type_) { | 466 switch (type_) { |
463 case READ_LENGTH: GenerateReadLength(masm); break; | 467 case READ_LENGTH: GenerateReadLength(masm); break; |
464 case READ_ELEMENT: GenerateReadElement(masm); break; | 468 case READ_ELEMENT: GenerateReadElement(masm); break; |
465 case NEW_OBJECT: GenerateNewObject(masm); break; | 469 case NEW_OBJECT: GenerateNewObject(masm); break; |
466 } | 470 } |
467 } | 471 } |
468 | 472 |
469 | 473 |
470 } } // namespace v8::internal | 474 } } // namespace v8::internal |
OLD | NEW |