| Index: src/compilation-cache.cc
|
| diff --git a/src/compilation-cache.cc b/src/compilation-cache.cc
|
| index 54d4565e2dcd884bc1446ace8173a7225d153823..68f15064945226418b0c6c904ac6514243a5ade8 100644
|
| --- a/src/compilation-cache.cc
|
| +++ b/src/compilation-cache.cc
|
| @@ -184,7 +184,7 @@ Handle<SharedFunctionInfo> CompilationCacheScript::Lookup(
|
| { HandleScope scope(isolate());
|
| for (generation = 0; generation < generations(); generation++) {
|
| Handle<CompilationCacheTable> table = GetTable(generation);
|
| - Handle<Object> probe(table->Lookup(*source, *context), isolate());
|
| + Handle<Object> probe = table->Lookup(source, context);
|
| if (probe->IsSharedFunctionInfo()) {
|
| Handle<SharedFunctionInfo> function_info =
|
| Handle<SharedFunctionInfo>::cast(probe);
|
| @@ -239,22 +239,12 @@ Handle<SharedFunctionInfo> CompilationCacheScript::Lookup(
|
| }
|
|
|
|
|
| -MaybeObject* CompilationCacheScript::TryTablePut(
|
| - Handle<String> source,
|
| - Handle<Context> context,
|
| - Handle<SharedFunctionInfo> function_info) {
|
| - Handle<CompilationCacheTable> table = GetFirstTable();
|
| - return table->Put(*source, *context, *function_info);
|
| -}
|
| -
|
| -
|
| Handle<CompilationCacheTable> CompilationCacheScript::TablePut(
|
| Handle<String> source,
|
| Handle<Context> context,
|
| Handle<SharedFunctionInfo> function_info) {
|
| - CALL_HEAP_FUNCTION(isolate(),
|
| - TryTablePut(source, context, function_info),
|
| - CompilationCacheTable);
|
| + Handle<CompilationCacheTable> table = GetFirstTable();
|
| + return CompilationCacheTable::Put(table, source, context, function_info);
|
| }
|
|
|
|
|
| @@ -274,21 +264,20 @@ Handle<SharedFunctionInfo> CompilationCacheEval::Lookup(
|
| // Make sure not to leak the table into the surrounding handle
|
| // scope. Otherwise, we risk keeping old tables around even after
|
| // having cleared the cache.
|
| - Object* result = NULL;
|
| + Handle<Object> result = isolate()->factory()->undefined_value();
|
| int generation;
|
| { HandleScope scope(isolate());
|
| + Handle<Object> temp = result;
|
| for (generation = 0; generation < generations(); generation++) {
|
| Handle<CompilationCacheTable> table = GetTable(generation);
|
| - result = table->LookupEval(
|
| - *source, *context, strict_mode, scope_position);
|
| - if (result->IsSharedFunctionInfo()) {
|
| - break;
|
| - }
|
| + temp = table->LookupEval(source, context, strict_mode, scope_position);
|
| + if (temp->IsSharedFunctionInfo()) break;
|
| }
|
| + if (temp->IsSharedFunctionInfo()) result = scope.CloseAndEscape(temp);
|
| }
|
| if (result->IsSharedFunctionInfo()) {
|
| - Handle<SharedFunctionInfo>
|
| - function_info(SharedFunctionInfo::cast(result), isolate());
|
| + Handle<SharedFunctionInfo> function_info =
|
| + Handle<SharedFunctionInfo>::cast(result);
|
| if (generation != 0) {
|
| Put(source, context, function_info, scope_position);
|
| }
|
| @@ -301,25 +290,14 @@ Handle<SharedFunctionInfo> CompilationCacheEval::Lookup(
|
| }
|
|
|
|
|
| -MaybeObject* CompilationCacheEval::TryTablePut(
|
| - Handle<String> source,
|
| - Handle<Context> context,
|
| - Handle<SharedFunctionInfo> function_info,
|
| - int scope_position) {
|
| - Handle<CompilationCacheTable> table = GetFirstTable();
|
| - return table->PutEval(*source, *context, *function_info, scope_position);
|
| -}
|
| -
|
| -
|
| Handle<CompilationCacheTable> CompilationCacheEval::TablePut(
|
| Handle<String> source,
|
| Handle<Context> context,
|
| Handle<SharedFunctionInfo> function_info,
|
| int scope_position) {
|
| - CALL_HEAP_FUNCTION(isolate(),
|
| - TryTablePut(
|
| - source, context, function_info, scope_position),
|
| - CompilationCacheTable);
|
| + Handle<CompilationCacheTable> table = GetFirstTable();
|
| + return CompilationCacheTable::PutEval(table, source, context,
|
| + function_info, scope_position);
|
| }
|
|
|
|
|
| @@ -337,19 +315,21 @@ Handle<FixedArray> CompilationCacheRegExp::Lookup(Handle<String> source,
|
| // Make sure not to leak the table into the surrounding handle
|
| // scope. Otherwise, we risk keeping old tables around even after
|
| // having cleared the cache.
|
| - Object* result = NULL;
|
| + Handle<Object> result = isolate()->factory()->undefined_value();
|
| int generation;
|
| { HandleScope scope(isolate());
|
| + Handle<Object> temp = result;
|
| for (generation = 0; generation < generations(); generation++) {
|
| Handle<CompilationCacheTable> table = GetTable(generation);
|
| - result = table->LookupRegExp(*source, flags);
|
| - if (result->IsFixedArray()) {
|
| + temp = table->LookupRegExp(source, flags);
|
| + if (temp->IsFixedArray()) {
|
| break;
|
| }
|
| }
|
| + if (temp->IsSharedFunctionInfo()) result = scope.CloseAndEscape(temp);
|
| }
|
| if (result->IsFixedArray()) {
|
| - Handle<FixedArray> data(FixedArray::cast(result), isolate());
|
| + Handle<FixedArray> data = Handle<FixedArray>::cast(result);
|
| if (generation != 0) {
|
| Put(source, flags, data);
|
| }
|
| @@ -362,22 +342,12 @@ Handle<FixedArray> CompilationCacheRegExp::Lookup(Handle<String> source,
|
| }
|
|
|
|
|
| -MaybeObject* CompilationCacheRegExp::TryTablePut(
|
| - Handle<String> source,
|
| - JSRegExp::Flags flags,
|
| - Handle<FixedArray> data) {
|
| - Handle<CompilationCacheTable> table = GetFirstTable();
|
| - return table->PutRegExp(*source, flags, *data);
|
| -}
|
| -
|
| -
|
| Handle<CompilationCacheTable> CompilationCacheRegExp::TablePut(
|
| Handle<String> source,
|
| JSRegExp::Flags flags,
|
| Handle<FixedArray> data) {
|
| - CALL_HEAP_FUNCTION(isolate(),
|
| - TryTablePut(source, flags, data),
|
| - CompilationCacheTable);
|
| + Handle<CompilationCacheTable> table = GetFirstTable();
|
| + return CompilationCacheTable::PutRegExp(table, source, flags, data);
|
| }
|
|
|
|
|
|
|