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

Side by Side Diff: src/objects.cc

Issue 475423003: Implement Function.prototype.toMethod. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: CR feedback Created 6 years, 4 months 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
« no previous file with comments | « src/objects.h ('k') | src/runtime.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/allocation-site-scopes.h" 8 #include "src/allocation-site-scopes.h"
9 #include "src/api.h" 9 #include "src/api.h"
10 #include "src/arguments.h" 10 #include "src/arguments.h"
(...skipping 9281 matching lines...) Expand 10 before | Expand all | Expand 10 after
9292 PrintF(" ** Queueing "); 9292 PrintF(" ** Queueing ");
9293 PrintName(); 9293 PrintName();
9294 PrintF(" for concurrent recompilation.\n"); 9294 PrintF(" for concurrent recompilation.\n");
9295 } 9295 }
9296 set_code_no_write_barrier( 9296 set_code_no_write_barrier(
9297 GetIsolate()->builtins()->builtin(Builtins::kInOptimizationQueue)); 9297 GetIsolate()->builtins()->builtin(Builtins::kInOptimizationQueue));
9298 // No write barrier required, since the builtin is part of the root set. 9298 // No write barrier required, since the builtin is part of the root set.
9299 } 9299 }
9300 9300
9301 9301
9302 Handle<JSFunction> JSFunction::CloneClosure(Handle<JSFunction> function) {
9303 Isolate* isolate = function->GetIsolate();
9304 Handle<Map> map(function->map());
9305 Handle<SharedFunctionInfo> shared(function->shared());
9306 Handle<Context> context(function->context());
9307 Handle<JSFunction> clone =
9308 isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, context);
9309
9310 if (shared->bound()) {
9311 clone->set_function_bindings(function->function_bindings());
9312 }
9313
9314 // In typical case, __proto__ of ``function`` is the default Function
9315 // prototype, which means that SetPrototype below is a no-op.
Toon Verwaest 2014/08/21 11:32:28 Now this comment is a bit off
9316 // In rare cases when that is not true, we mutate the clone's __proto__.
9317 Handle<Object> original_prototype(map->prototype(), isolate);
9318 if (*original_prototype != clone->map()->prototype()) {
9319 JSObject::SetPrototype(clone, original_prototype, false).Assert();
9320 }
9321
9322 return clone;
9323 }
9324
9325
9302 void SharedFunctionInfo::AddToOptimizedCodeMap( 9326 void SharedFunctionInfo::AddToOptimizedCodeMap(
9303 Handle<SharedFunctionInfo> shared, 9327 Handle<SharedFunctionInfo> shared,
9304 Handle<Context> native_context, 9328 Handle<Context> native_context,
9305 Handle<Code> code, 9329 Handle<Code> code,
9306 Handle<FixedArray> literals, 9330 Handle<FixedArray> literals,
9307 BailoutId osr_ast_id) { 9331 BailoutId osr_ast_id) {
9308 Isolate* isolate = shared->GetIsolate(); 9332 Isolate* isolate = shared->GetIsolate();
9309 DCHECK(code->kind() == Code::OPTIMIZED_FUNCTION); 9333 DCHECK(code->kind() == Code::OPTIMIZED_FUNCTION);
9310 DCHECK(native_context->IsNativeContext()); 9334 DCHECK(native_context->IsNativeContext());
9311 STATIC_ASSERT(kEntryLength == 4); 9335 STATIC_ASSERT(kEntryLength == 4);
(...skipping 7250 matching lines...) Expand 10 before | Expand all | Expand 10 after
16562 #define ERROR_MESSAGES_TEXTS(C, T) T, 16586 #define ERROR_MESSAGES_TEXTS(C, T) T,
16563 static const char* error_messages_[] = { 16587 static const char* error_messages_[] = {
16564 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 16588 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16565 }; 16589 };
16566 #undef ERROR_MESSAGES_TEXTS 16590 #undef ERROR_MESSAGES_TEXTS
16567 return error_messages_[reason]; 16591 return error_messages_[reason];
16568 } 16592 }
16569 16593
16570 16594
16571 } } // namespace v8::internal 16595 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698