Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: src/runtime.cc

Issue 437153002: Use ARRAY_SIZE instead of DIY code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdlib.h> 5 #include <stdlib.h>
6 #include <limits> 6 #include <limits>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 15557 matching lines...) Expand 10 before | Expand all | Expand 10 after
15568 if (entry != kNotFound) { 15568 if (entry != kNotFound) {
15569 Object* smi_index = heap->intrinsic_function_names()->ValueAt(entry); 15569 Object* smi_index = heap->intrinsic_function_names()->ValueAt(entry);
15570 int function_index = Smi::cast(smi_index)->value(); 15570 int function_index = Smi::cast(smi_index)->value();
15571 return &(kIntrinsicFunctions[function_index]); 15571 return &(kIntrinsicFunctions[function_index]);
15572 } 15572 }
15573 return NULL; 15573 return NULL;
15574 } 15574 }
15575 15575
15576 15576
15577 const Runtime::Function* Runtime::FunctionForEntry(Address entry) { 15577 const Runtime::Function* Runtime::FunctionForEntry(Address entry) {
15578 size_t length = sizeof(kIntrinsicFunctions) / sizeof(*kIntrinsicFunctions); 15578 for (size_t i = 0; i < ARRAY_SIZE(kIntrinsicFunctions); ++i) {
15579 for (size_t i = 0; i < length; ++i) {
15580 if (entry == kIntrinsicFunctions[i].entry) { 15579 if (entry == kIntrinsicFunctions[i].entry) {
15581 return &(kIntrinsicFunctions[i]); 15580 return &(kIntrinsicFunctions[i]);
15582 } 15581 }
15583 } 15582 }
15584 return NULL; 15583 return NULL;
15585 } 15584 }
15586 15585
15587 15586
15588 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { 15587 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
15589 return &(kIntrinsicFunctions[static_cast<int>(id)]); 15588 return &(kIntrinsicFunctions[static_cast<int>(id)]);
15590 } 15589 }
15591 15590
15592 } } // namespace v8::internal 15591 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698