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

Side by Side Diff: src/objects.h

Issue 101853003: Cache optimized code for OSR. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 6512 matching lines...) Expand 10 before | Expand all | Expand 10 after
6523 DECL_ACCESSORS(name, Object) 6523 DECL_ACCESSORS(name, Object)
6524 6524
6525 // [code]: Function code. 6525 // [code]: Function code.
6526 DECL_ACCESSORS(code, Code) 6526 DECL_ACCESSORS(code, Code)
6527 inline void ReplaceCode(Code* code); 6527 inline void ReplaceCode(Code* code);
6528 6528
6529 // [optimized_code_map]: Map from native context to optimized code 6529 // [optimized_code_map]: Map from native context to optimized code
6530 // and a shared literals array or Smi(0) if none. 6530 // and a shared literals array or Smi(0) if none.
6531 DECL_ACCESSORS(optimized_code_map, Object) 6531 DECL_ACCESSORS(optimized_code_map, Object)
6532 6532
6533 // Returns index i of the entry with the specified context. At position 6533 // Returns index i of the entry with the specified context and OSR entry.
6534 // i - 1 is the context, position i the code, and i + 1 the literals array. 6534 // At position i - 1 is the context, position i the code, and i + 1 the
6535 // Returns -1 when no matching entry is found. 6535 // literals array. Returns -1 when no matching entry is found.
6536 int SearchOptimizedCodeMap(Context* native_context); 6536 int SearchOptimizedCodeMap(Context* native_context, BailoutId osr_ast_id);
6537 6537
6538 // Installs optimized code from the code map on the given closure. The 6538 // Installs optimized code from the code map on the given closure. The
6539 // index has to be consistent with a search result as defined above. 6539 // index has to be consistent with a search result as defined above.
6540 FixedArray* GetLiteralsFromOptimizedCodeMap(int index); 6540 FixedArray* GetLiteralsFromOptimizedCodeMap(int index);
6541 6541
6542 Code* GetCodeFromOptimizedCodeMap(int index); 6542 Code* GetCodeFromOptimizedCodeMap(int index);
6543 6543
6544 // Clear optimized code map. 6544 // Clear optimized code map.
6545 void ClearOptimizedCodeMap(); 6545 void ClearOptimizedCodeMap();
6546 6546
6547 // Removed a specific optimized code object from the optimized code map. 6547 // Removed a specific optimized code object from the optimized code map.
6548 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason); 6548 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason);
6549 6549
6550 // Trims the optimized code map after entries have been removed. 6550 // Trims the optimized code map after entries have been removed.
6551 void TrimOptimizedCodeMap(int shrink_by); 6551 void TrimOptimizedCodeMap(int shrink_by);
6552 6552
6553 // Add a new entry to the optimized code map. 6553 // Add a new entry to the optimized code map.
6554 MUST_USE_RESULT MaybeObject* AddToOptimizedCodeMap(Context* native_context, 6554 MUST_USE_RESULT MaybeObject* AddToOptimizedCodeMap(Context* native_context,
6555 Code* code, 6555 Code* code,
6556 FixedArray* literals); 6556 FixedArray* literals,
6557 BailoutId osr_ast_id);
6557 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, 6558 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared,
6558 Handle<Context> native_context, 6559 Handle<Context> native_context,
6559 Handle<Code> code, 6560 Handle<Code> code,
6560 Handle<FixedArray> literals); 6561 Handle<FixedArray> literals,
6562 BailoutId osr_ast_id);
6561 6563
6562 // Layout description of the optimized code map. 6564 // Layout description of the optimized code map.
6563 static const int kNextMapIndex = 0; 6565 static const int kNextMapIndex = 0;
6564 static const int kEntriesStart = 1; 6566 static const int kEntriesStart = 1;
6565 static const int kEntryLength = 3; 6567 static const int kEntryLength = 4;
6566 static const int kFirstContextSlot = FixedArray::kHeaderSize + kPointerSize; 6568 static const int kFirstContextSlot = FixedArray::kHeaderSize + kPointerSize;
6567 static const int kFirstCodeSlot = FixedArray::kHeaderSize + 2 * kPointerSize; 6569 static const int kFirstCodeSlot = FixedArray::kHeaderSize + 2 * kPointerSize;
6570 static const int kFirstOsrAstIdSlot =
6571 FixedArray::kHeaderSize + 4 * kPointerSize;
6568 static const int kSecondEntryIndex = kEntryLength + kEntriesStart; 6572 static const int kSecondEntryIndex = kEntryLength + kEntriesStart;
6569 static const int kInitialLength = kEntriesStart + kEntryLength; 6573 static const int kInitialLength = kEntriesStart + kEntryLength;
6570 6574
6571 // [scope_info]: Scope info. 6575 // [scope_info]: Scope info.
6572 DECL_ACCESSORS(scope_info, ScopeInfo) 6576 DECL_ACCESSORS(scope_info, ScopeInfo)
6573 6577
6574 // [construct stub]: Code stub for constructing instances of this function. 6578 // [construct stub]: Code stub for constructing instances of this function.
6575 DECL_ACCESSORS(construct_stub, Code) 6579 DECL_ACCESSORS(construct_stub, Code)
6576 6580
6577 // Returns if this function has been compiled to native code yet. 6581 // Returns if this function has been compiled to native code yet.
(...skipping 4017 matching lines...) Expand 10 before | Expand all | Expand 10 after
10595 } else { 10599 } else {
10596 value &= ~(1 << bit_position); 10600 value &= ~(1 << bit_position);
10597 } 10601 }
10598 return value; 10602 return value;
10599 } 10603 }
10600 }; 10604 };
10601 10605
10602 } } // namespace v8::internal 10606 } } // namespace v8::internal
10603 10607
10604 #endif // V8_OBJECTS_H_ 10608 #endif // V8_OBJECTS_H_
OLDNEW
« src/code-stubs-hydrogen.cc ('K') | « src/mark-compact.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698