Commit 116667f7 authored by jgruber's avatar jgruber Committed by Commit bot

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}
parent 92b7c728
...@@ -1443,6 +1443,7 @@ Handle<Code> Factory::NewCode(const CodeDesc& desc, ...@@ -1443,6 +1443,7 @@ Handle<Code> Factory::NewCode(const CodeDesc& desc,
code->set_source_position_table(*empty_byte_array(), SKIP_WRITE_BARRIER); code->set_source_position_table(*empty_byte_array(), SKIP_WRITE_BARRIER);
code->set_prologue_offset(prologue_offset); code->set_prologue_offset(prologue_offset);
code->set_constant_pool_offset(desc.instr_size - desc.constant_pool_size); code->set_constant_pool_offset(desc.instr_size - desc.constant_pool_size);
code->set_builtin_index(-1);
if (code->kind() == Code::OPTIMIZED_FUNCTION) { if (code->kind() == Code::OPTIMIZED_FUNCTION) {
code->set_marked_for_deoptimization(false); code->set_marked_for_deoptimization(false);
......
...@@ -5179,11 +5179,9 @@ class Code: public HeapObject { ...@@ -5179,11 +5179,9 @@ class Code: public HeapObject {
inline int profiler_ticks(); inline int profiler_ticks();
inline void set_profiler_ticks(int ticks); inline void set_profiler_ticks(int ticks);
// [builtin_index]: For BUILTIN kind, tells which builtin index it has. // [builtin_index]: For builtins, tells which builtin index the code object
// For builtins, tells which builtin index it has. // has. Note that builtins can have a code kind other than BUILTIN. The
// Note that builtins can have a code kind other than BUILTIN, which means // builtin index is a non-negative integer for builtins, and -1 otherwise.
// 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.
inline int builtin_index(); inline int builtin_index();
inline void set_builtin_index(int id); inline void set_builtin_index(int id);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment