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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 // CompilationInfo encapsulates some information known at compile time. It | 43 // CompilationInfo encapsulates some information known at compile time. It |
44 // is constructed based on the resources available at compile-time. | 44 // is constructed based on the resources available at compile-time. |
45 class CompilationInfo { | 45 class CompilationInfo { |
46 public: | 46 public: |
47 CompilationInfo(Handle<Script> script, Zone* zone); | 47 CompilationInfo(Handle<Script> script, Zone* zone); |
48 CompilationInfo(Handle<SharedFunctionInfo> shared_info, Zone* zone); | 48 CompilationInfo(Handle<SharedFunctionInfo> shared_info, Zone* zone); |
49 CompilationInfo(Handle<JSFunction> closure, Zone* zone); | 49 CompilationInfo(Handle<JSFunction> closure, Zone* zone); |
50 CompilationInfo(HydrogenCodeStub* stub, Isolate* isolate, Zone* zone); | 50 CompilationInfo(HydrogenCodeStub* stub, Isolate* isolate, Zone* zone); |
51 | 51 |
52 virtual ~CompilationInfo(); | 52 ~CompilationInfo(); |
53 | 53 |
54 Isolate* isolate() { | 54 Isolate* isolate() { |
55 ASSERT(Isolate::Current() == isolate_); | 55 ASSERT(Isolate::Current() == isolate_); |
56 return isolate_; | 56 return isolate_; |
57 } | 57 } |
58 Zone* zone() { | 58 Zone* zone() { |
59 return zone_; | 59 return zone_; |
60 } | 60 } |
61 bool is_lazy() const { return IsLazy::decode(flags_); } | 61 bool is_lazy() const { return IsLazy::decode(flags_); } |
62 bool is_eval() const { return IsEval::decode(flags_); } | 62 bool is_eval() const { return IsEval::decode(flags_); } |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 int opt_count_; | 342 int opt_count_; |
343 | 343 |
344 DISALLOW_COPY_AND_ASSIGN(CompilationInfo); | 344 DISALLOW_COPY_AND_ASSIGN(CompilationInfo); |
345 }; | 345 }; |
346 | 346 |
347 | 347 |
348 // Exactly like a CompilationInfo, except also creates and enters a | 348 // Exactly like a CompilationInfo, except also creates and enters a |
349 // Zone on construction and deallocates it on exit. | 349 // Zone on construction and deallocates it on exit. |
350 class CompilationInfoWithZone: public CompilationInfo { | 350 class CompilationInfoWithZone: public CompilationInfo { |
351 public: | 351 public: |
352 INLINE(void* operator new(size_t size)) { return Malloced::New(size); } | |
353 | |
354 explicit CompilationInfoWithZone(Handle<Script> script) | 352 explicit CompilationInfoWithZone(Handle<Script> script) |
355 : CompilationInfo(script, &zone_), | 353 : CompilationInfo(script, &zone_), |
356 zone_(script->GetIsolate()), | 354 zone_(script->GetIsolate()), |
357 zone_scope_(&zone_, DELETE_ON_EXIT) {} | 355 zone_scope_(&zone_, DELETE_ON_EXIT) {} |
358 explicit CompilationInfoWithZone(Handle<SharedFunctionInfo> shared_info) | 356 explicit CompilationInfoWithZone(Handle<SharedFunctionInfo> shared_info) |
359 : CompilationInfo(shared_info, &zone_), | 357 : CompilationInfo(shared_info, &zone_), |
360 zone_(shared_info->GetIsolate()), | 358 zone_(shared_info->GetIsolate()), |
361 zone_scope_(&zone_, DELETE_ON_EXIT) {} | 359 zone_scope_(&zone_, DELETE_ON_EXIT) {} |
362 explicit CompilationInfoWithZone(Handle<JSFunction> closure) | 360 explicit CompilationInfoWithZone(Handle<JSFunction> closure) |
363 : CompilationInfo(closure, &zone_), | 361 : CompilationInfo(closure, &zone_), |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 | 529 |
532 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, | 530 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, |
533 CompilationInfo* info, | 531 CompilationInfo* info, |
534 Handle<SharedFunctionInfo> shared); | 532 Handle<SharedFunctionInfo> shared); |
535 }; | 533 }; |
536 | 534 |
537 | 535 |
538 } } // namespace v8::internal | 536 } } // namespace v8::internal |
539 | 537 |
540 #endif // V8_COMPILER_H_ | 538 #endif // V8_COMPILER_H_ |
OLD | NEW |