Explicitly initialize Code::builtin_index

Initialize Code::builtin_index to -1. This ensures that it is
non-negative for builtin code objects (since it is set by
Builtins::SetUp), and -1 for everything else.

BUG=

Review-Url: https://codereview.chromium.org/2254193002
Cr-Commit-Position: refs/heads/master@{#38719}
This commit is contained in:
jgruber 2016-08-18 07:34:03 -07:00 committed by Commit bot
parent 92b7c728e2
commit 116667f73e
2 changed files with 4 additions and 5 deletions

View File

@ -1443,6 +1443,7 @@ Handle<Code> Factory::NewCode(const CodeDesc& desc,
code->set_source_position_table(*empty_byte_array(), SKIP_WRITE_BARRIER);
code->set_prologue_offset(prologue_offset);
code->set_constant_pool_offset(desc.instr_size - desc.constant_pool_size);
code->set_builtin_index(-1);
if (code->kind() == Code::OPTIMIZED_FUNCTION) {
code->set_marked_for_deoptimization(false);

View File

@ -5179,11 +5179,9 @@ class Code: public HeapObject {
inline int profiler_ticks();
inline void set_profiler_ticks(int ticks);
// [builtin_index]: For BUILTIN kind, tells which builtin index it has.
// For builtins, tells which builtin index it has.
// Note that builtins can have a code kind other than BUILTIN, which means
// that for arbitrary code objects, this index value may be random garbage.
// To verify in that case, compare the code object to the indexed builtin.
// [builtin_index]: For builtins, tells which builtin index the code object
// has. Note that builtins can have a code kind other than BUILTIN. The
// builtin index is a non-negative integer for builtins, and -1 otherwise.
inline int builtin_index();
inline void set_builtin_index(int id);