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 29 matching lines...) Expand all Loading... | |
40 class ScriptDataImpl; | 40 class ScriptDataImpl; |
41 class HydrogenCodeStub; | 41 class HydrogenCodeStub; |
42 | 42 |
43 // ParseRestriction is used to restrict the set of valid statements in a | 43 // ParseRestriction is used to restrict the set of valid statements in a |
44 // unit of compilation. Restriction violations cause a syntax error. | 44 // unit of compilation. Restriction violations cause a syntax error. |
45 enum ParseRestriction { | 45 enum ParseRestriction { |
46 NO_PARSE_RESTRICTION, // All expressions are allowed. | 46 NO_PARSE_RESTRICTION, // All expressions are allowed. |
47 ONLY_SINGLE_FUNCTION_LITERAL // Only a single FunctionLiteral expression. | 47 ONLY_SINGLE_FUNCTION_LITERAL // Only a single FunctionLiteral expression. |
48 }; | 48 }; |
49 | 49 |
50 struct OffsetRange { | |
51 OffsetRange(int from, int to) : from(from), to(to) {} | |
52 int from; | |
53 int to; | |
54 }; | |
55 | |
50 // CompilationInfo encapsulates some information known at compile time. It | 56 // CompilationInfo encapsulates some information known at compile time. It |
51 // is constructed based on the resources available at compile-time. | 57 // is constructed based on the resources available at compile-time. |
52 class CompilationInfo { | 58 class CompilationInfo { |
53 public: | 59 public: |
54 CompilationInfo(Handle<Script> script, Zone* zone); | 60 CompilationInfo(Handle<Script> script, Zone* zone); |
55 CompilationInfo(Handle<SharedFunctionInfo> shared_info, Zone* zone); | 61 CompilationInfo(Handle<SharedFunctionInfo> shared_info, Zone* zone); |
56 CompilationInfo(Handle<JSFunction> closure, Zone* zone); | 62 CompilationInfo(Handle<JSFunction> closure, Zone* zone); |
57 CompilationInfo(HydrogenCodeStub* stub, Isolate* isolate, Zone* zone); | 63 CompilationInfo(HydrogenCodeStub* stub, Isolate* isolate, Zone* zone); |
58 | 64 |
59 ~CompilationInfo(); | 65 ~CompilationInfo(); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
250 int prologue_offset() const { | 256 int prologue_offset() const { |
251 ASSERT_NE(kPrologueOffsetNotSet, prologue_offset_); | 257 ASSERT_NE(kPrologueOffsetNotSet, prologue_offset_); |
252 return prologue_offset_; | 258 return prologue_offset_; |
253 } | 259 } |
254 | 260 |
255 void set_prologue_offset(int prologue_offset) { | 261 void set_prologue_offset(int prologue_offset) { |
256 ASSERT_EQ(kPrologueOffsetNotSet, prologue_offset_); | 262 ASSERT_EQ(kPrologueOffsetNotSet, prologue_offset_); |
257 prologue_offset_ = prologue_offset; | 263 prologue_offset_ = prologue_offset; |
258 } | 264 } |
259 | 265 |
266 // Adds offset range [from, to) where fp register does not point | |
267 // to the current frame base. Used in CPU profiler to detect stack | |
268 // samples where top frame is not setup. | |
Jakob Kummerow
2013/05/14 12:38:51
nit: s/setup/set up/
yurys
2013/05/14 22:51:19
Done.
| |
269 inline void AddNoFrameRange(int from, int to) { | |
270 if (no_frame_ranges_) no_frame_ranges_->Add(OffsetRange(from, to)); | |
271 } | |
272 | |
273 List<OffsetRange>* ReleaseNoFrameRanges() { | |
274 List<OffsetRange>* result = no_frame_ranges_; | |
275 no_frame_ranges_ = NULL; | |
276 return result; | |
277 } | |
278 | |
279 | |
260 private: | 280 private: |
261 Isolate* isolate_; | 281 Isolate* isolate_; |
262 | 282 |
263 // Compilation mode. | 283 // Compilation mode. |
264 // BASE is generated by the full codegen, optionally prepared for bailouts. | 284 // BASE is generated by the full codegen, optionally prepared for bailouts. |
265 // OPTIMIZE is optimized code generated by the Hydrogen-based backend. | 285 // OPTIMIZE is optimized code generated by the Hydrogen-based backend. |
266 // NONOPT is generated by the full codegen and is not prepared for | 286 // NONOPT is generated by the full codegen and is not prepared for |
267 // recompilation/bailouts. These functions are never recompiled. | 287 // recompilation/bailouts. These functions are never recompiled. |
268 enum Mode { | 288 enum Mode { |
269 BASE, | 289 BASE, |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
354 if (!object->is_null()) { | 374 if (!object->is_null()) { |
355 Handle<T> handle(*(*object)); | 375 Handle<T> handle(*(*object)); |
356 *object = handle; | 376 *object = handle; |
357 } | 377 } |
358 } | 378 } |
359 | 379 |
360 const char* bailout_reason_; | 380 const char* bailout_reason_; |
361 | 381 |
362 int prologue_offset_; | 382 int prologue_offset_; |
363 | 383 |
384 List<OffsetRange>* no_frame_ranges_; | |
385 | |
364 // A copy of shared_info()->opt_count() to avoid handle deref | 386 // A copy of shared_info()->opt_count() to avoid handle deref |
365 // during graph optimization. | 387 // during graph optimization. |
366 int opt_count_; | 388 int opt_count_; |
367 | 389 |
368 DISALLOW_COPY_AND_ASSIGN(CompilationInfo); | 390 DISALLOW_COPY_AND_ASSIGN(CompilationInfo); |
369 }; | 391 }; |
370 | 392 |
371 | 393 |
372 // Exactly like a CompilationInfo, except also creates and enters a | 394 // Exactly like a CompilationInfo, except also creates and enters a |
373 // Zone on construction and deallocates it on exit. | 395 // Zone on construction and deallocates it on exit. |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
554 | 576 |
555 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, | 577 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, |
556 CompilationInfo* info, | 578 CompilationInfo* info, |
557 Handle<SharedFunctionInfo> shared); | 579 Handle<SharedFunctionInfo> shared); |
558 }; | 580 }; |
559 | 581 |
560 | 582 |
561 } } // namespace v8::internal | 583 } } // namespace v8::internal |
562 | 584 |
563 #endif // V8_COMPILER_H_ | 585 #endif // V8_COMPILER_H_ |
OLD | NEW |