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

Side by Side Diff: src/objects.h

Issue 100613004: Use optimized code map to cache OSR code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: correctly upload stuff Created 7 years 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
OLDNEW
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 5338 matching lines...) Expand 10 before | Expand all | Expand 10 after
5349 5349
5350 DECLARE_PRINTER(Code) 5350 DECLARE_PRINTER(Code)
5351 DECLARE_VERIFIER(Code) 5351 DECLARE_VERIFIER(Code)
5352 5352
5353 void ClearInlineCaches(); 5353 void ClearInlineCaches();
5354 void ClearInlineCaches(Kind kind); 5354 void ClearInlineCaches(Kind kind);
5355 5355
5356 void ClearTypeFeedbackCells(Heap* heap); 5356 void ClearTypeFeedbackCells(Heap* heap);
5357 5357
5358 BailoutId TranslatePcOffsetToAstId(uint32_t pc_offset); 5358 BailoutId TranslatePcOffsetToAstId(uint32_t pc_offset);
5359 uint32_t TranslateAstIdToPcOffset(BailoutId ast_id);
5359 5360
5360 #define DECLARE_CODE_AGE_ENUM(X) k##X##CodeAge, 5361 #define DECLARE_CODE_AGE_ENUM(X) k##X##CodeAge,
5361 enum Age { 5362 enum Age {
5362 kNotExecutedCodeAge = -2, 5363 kNotExecutedCodeAge = -2,
5363 kExecutedOnceCodeAge = -1, 5364 kExecutedOnceCodeAge = -1,
5364 kNoAgeCodeAge = 0, 5365 kNoAgeCodeAge = 0,
5365 CODE_AGE_LIST(DECLARE_CODE_AGE_ENUM) 5366 CODE_AGE_LIST(DECLARE_CODE_AGE_ENUM)
5366 kAfterLastCodeAge, 5367 kAfterLastCodeAge,
5367 kFirstCodeAge = kNotExecutedCodeAge, 5368 kFirstCodeAge = kNotExecutedCodeAge,
5368 kLastCodeAge = kAfterLastCodeAge - 1, 5369 kLastCodeAge = kAfterLastCodeAge - 1,
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after
6530 DECL_ACCESSORS(code, Code) 6531 DECL_ACCESSORS(code, Code)
6531 inline void ReplaceCode(Code* code); 6532 inline void ReplaceCode(Code* code);
6532 6533
6533 // [optimized_code_map]: Map from native context to optimized code 6534 // [optimized_code_map]: Map from native context to optimized code
6534 // and a shared literals array or Smi(0) if none. 6535 // and a shared literals array or Smi(0) if none.
6535 DECL_ACCESSORS(optimized_code_map, Object) 6536 DECL_ACCESSORS(optimized_code_map, Object)
6536 6537
6537 // Returns index i of the entry with the specified context. At position 6538 // Returns index i of the entry with the specified context. At position
6538 // i - 1 is the context, position i the code, and i + 1 the literals array. 6539 // i - 1 is the context, position i the code, and i + 1 the literals array.
6539 // Returns -1 when no matching entry is found. 6540 // Returns -1 when no matching entry is found.
6540 int SearchOptimizedCodeMap(Context* native_context); 6541 int SearchOptimizedCodeMap(Context* native_context, BailoutId osr_ast_id);
6541 6542
6542 // Installs optimized code from the code map on the given closure. The 6543 // Installs optimized code from the code map on the given closure. The
6543 // index has to be consistent with a search result as defined above. 6544 // index has to be consistent with a search result as defined above.
6544 void InstallFromOptimizedCodeMap(JSFunction* function, int index); 6545 void InstallFromOptimizedCodeMap(JSFunction* function, int index);
6545 6546
6546 // Clear optimized code map. 6547 // Clear optimized code map.
6547 void ClearOptimizedCodeMap(); 6548 void ClearOptimizedCodeMap();
6548 6549
6549 // Removed a specific optimized code object from the optimized code map. 6550 // Removed a specific optimized code object from the optimized code map.
6550 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason); 6551 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason);
6551 6552
6552 // Trims the optimized code map after entries have been removed. 6553 // Trims the optimized code map after entries have been removed.
6553 void TrimOptimizedCodeMap(int shrink_by); 6554 void TrimOptimizedCodeMap(int shrink_by);
6554 6555
6555 // Add a new entry to the optimized code map. 6556 // Add a new entry to the optimized code map.
6556 MUST_USE_RESULT MaybeObject* AddToOptimizedCodeMap(Context* native_context, 6557 MUST_USE_RESULT MaybeObject* AddToOptimizedCodeMap(Context* native_context,
6557 Code* code, 6558 Code* code,
6558 FixedArray* literals); 6559 FixedArray* literals,
6560 BailoutId osr_ast_id);
6559 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, 6561 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared,
6560 Handle<Context> native_context, 6562 Handle<Context> native_context,
6561 Handle<Code> code, 6563 Handle<Code> code,
6562 Handle<FixedArray> literals); 6564 Handle<FixedArray> literals,
6565 BailoutId osr_ast_id);
6563 6566
6564 // Layout description of the optimized code map. 6567 // Layout description of the optimized code map.
6565 static const int kNextMapIndex = 0; 6568 static const int kNextMapIndex = 0;
6566 static const int kEntriesStart = 1; 6569 static const int kEntriesStart = 1;
6567 static const int kEntryLength = 3; 6570 static const int kEntryLength = 4;
6568 static const int kFirstContextSlot = FixedArray::kHeaderSize + kPointerSize; 6571 static const int kFirstContextSlot = FixedArray::kHeaderSize + kPointerSize;
6569 static const int kFirstCodeSlot = FixedArray::kHeaderSize + 2 * kPointerSize; 6572 static const int kFirstCodeSlot = FixedArray::kHeaderSize + 2 * kPointerSize;
6573 static const int kFirstOsrAstIdSlot =
6574 FixedArray::kHeaderSize + 4 * kPointerSize;
6570 static const int kSecondEntryIndex = kEntryLength + kEntriesStart; 6575 static const int kSecondEntryIndex = kEntryLength + kEntriesStart;
6571 static const int kInitialLength = kEntriesStart + kEntryLength; 6576 static const int kInitialLength = kEntriesStart + kEntryLength;
6572 6577
6573 // [scope_info]: Scope info. 6578 // [scope_info]: Scope info.
6574 DECL_ACCESSORS(scope_info, ScopeInfo) 6579 DECL_ACCESSORS(scope_info, ScopeInfo)
6575 6580
6576 // [construct stub]: Code stub for constructing instances of this function. 6581 // [construct stub]: Code stub for constructing instances of this function.
6577 DECL_ACCESSORS(construct_stub, Code) 6582 DECL_ACCESSORS(construct_stub, Code)
6578 6583
6579 // Returns if this function has been compiled to native code yet. 6584 // Returns if this function has been compiled to native code yet.
(...skipping 4032 matching lines...) Expand 10 before | Expand all | Expand 10 after
10612 } else { 10617 } else {
10613 value &= ~(1 << bit_position); 10618 value &= ~(1 << bit_position);
10614 } 10619 }
10615 return value; 10620 return value;
10616 } 10621 }
10617 }; 10622 };
10618 10623
10619 } } // namespace v8::internal 10624 } } // namespace v8::internal
10620 10625
10621 #endif // V8_OBJECTS_H_ 10626 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/mark-compact.cc ('k') | src/objects.cc » ('j') | src/runtime.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698